Created
August 25, 2022 17:00
-
-
Save carlocab/6576556282d776a3f66de4203d7f4869 to your computer and use it in GitHub Desktop.
Rebase failing PRs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LIMIT=250 | |
CLOSE_MESSAGE="please reopen against master" | |
failed_prs="$(gh pr list --limit $LIMIT --search 'status:failure' | cut -f1)" | |
git fetch origin | |
for pr in $failed_prs | |
do | |
gh pr checkout "$pr" | |
if ! git rebase origin/master | |
then | |
git rebase --abort | |
gh pr close "$pr" --comment "$CLOSE_MESSAGE" | |
elif ! git push --force-with-lease | |
then | |
gh pr close "$pr" --comment "$CLOSE_MESSAGE" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment