Skip to content

Instantly share code, notes, and snippets.

@rhighs
Created March 27, 2026 13:38
Show Gist options
  • Select an option

  • Save rhighs/18243b941dc96d7be8a014b82dab69d8 to your computer and use it in GitHub Desktop.

Select an option

Save rhighs/18243b941dc96d7be8a014b82dab69d8 to your computer and use it in GitHub Desktop.
Rerun failed jobs under a Github PR
gh-rerun-failed() {
local pr="${1:?Usage: gh-rerun-failed <PR_NUMBER>}"
gh run list --json databaseId,status,conclusion \
--jq '.[] | select(.conclusion == "failure" or .conclusion == "startup_failure") | .databaseId' \
$(gh pr view "$pr" --json headRefName --jq '"--branch " + .headRefName') \
| xargs -I{} gh run rerun {} --failed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment