Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/RerunUnstableFailures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
actions: write
contents: read
env:
MAX_FAILED_JOBS: 3 # Maximum number of failed jobs in order to consider rerunning
MAX_FAILED_JOBS: 10 # Maximum number of failed jobs in order to consider rerunning
MIN_TOTAL_JOBS: 10 # Minimum number of jobs that has run in order to consider rerunning
MAX_ATTEMPTS: 1 # Maximum number of attempts to rerun a failed job
steps:
Expand Down
16 changes: 14 additions & 2 deletions build/scripts/RerunUnstableFailures.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ if ($run.conclusion -ne 'failure') {
exit 0
}

if ($run.run_attempt -gt $MaxAttempts) {
Write-Host "Run $RunId is on attempt $($run.run_attempt) (max $MaxAttempts). Skipping."
# For PRs from forks, the first attempt is an approval gate that runs no jobs and
# concludes 'action_required'. This offsets the attempt numbering, so the first real
# build is attempt 2. Discount the gate attempt to compute the effective attempt.
$gateAttempts = 0
if ($run.run_attempt -gt 1) {
$firstAttemptConclusion = gh api "/repos/$Owner/$Repo/actions/runs/$RunId/attempts/1" --jq '.conclusion' 2>&1
if ($LASTEXITCODE -eq 0 -and $firstAttemptConclusion -eq 'action_required') {
$gateAttempts = 1
}
}
$effectiveAttempt = $run.run_attempt - $gateAttempts

if ($effectiveAttempt -gt $MaxAttempts) {
Write-Host "Run $RunId is on attempt $($run.run_attempt) (effective $effectiveAttempt, max $MaxAttempts). Skipping."
exit 0
}

Expand Down
Loading