Last active
March 24, 2025 22:08
-
-
Save lmmx/96490cb48b8520d01c0b565bb9acdc1c to your computer and use it in GitHub Desktop.
Merge all dependency bot PRs (e.g. pre-commit)
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
PR_CMDS=$(gh search prs --limit 100 --owner $(gh api user -q '.login') --author pre-commit-ci[bot] --state open --json repository,number | jq -r '.[] | "gh pr merge \(.number) -R \(.repository.nameWithOwner) -s -d"' | awk '{printf "%s%s", (NR==1 ? "" : " && \n"), $0} END{print ""}'); echo "$PR_CMDS"; eval "$PR_CMDS" |
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
PR_CMDS=$( | |
gh search prs \ | |
--limit 100 \ | |
--owner $(gh api user -q '.login') \ | |
--author pre-commit-ci[bot] \ | |
--state open \ | |
--json repository,number | | |
jq -r '.[] | "gh pr merge \(.number) -R \(.repository.nameWithOwner) -s -d"' | | |
awk '{printf "%s%s", (NR==1 ? "" : " && \n"), $0} END{print ""}' | |
) | |
echo "$PR_CMDS" | |
eval "$PR_CMDS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output:
(Which is then immediately executed and prints:)