Rebasing All Dependabot Pull Requests

jpoehnelt

Justin Poehnelt

Posted on May 12, 2022

Rebasing All Dependabot Pull Requests

The GitHub cli tool gh now has a search feature! I recently had a use case requiring DependaBot to rebase all pull requests across the GitHub organization repositories.

The following shell command did the trick by piping the output of gh search prs to gh pr comment:

gh search prs \
  --owner googlemaps \ # replace with GitHub owner
  --state open \
  --label dependencies \
  --limit 200 \
  --json "url" --jq ".[] | .url" \
| xargs -n 1 -I{} \
  gh pr comment -b "@dependabot rebase" {}
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
jpoehnelt
Justin Poehnelt

Posted on May 12, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related