Skip to content

Instantly share code, notes, and snippets.

@alexdewar
Last active November 21, 2024 09:40
Show Gist options
  • Save alexdewar/ace763f65a790e14f6d35239a8db1b58 to your computer and use it in GitHub Desktop.
Save alexdewar/ace763f65a790e14f6d35239a8db1b58 to your computer and use it in GitHub Desktop.
A script to merge all PRs from bots
#!/bin/bash
set -euo pipefail
for bot in pre-commit-ci dependabot; do
for pr in $(gh pr list --author ${bot}[bot]|awk '{print $1}'); do
# Depending on branch protection rules, an approving review may be required
gh pr review --approve "$pr"
# Merge via rebase if and when checks complete successfully
gh pr merge -r --auto "$pr"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment