[ci] Retry flaky tests only on PRs (#5492)