Roll up, rollup, get your Dependabot PRs together here


While I wait for GitHub to get their act together on my Dependabot Wishlist I’ve created a little script for my first frustration – rollups.

Another morning, another patch release of Dart, another 4 Dependabot PRs in my inbox:

Only this time I was able to simply run: 1247 1250

and the subsequent 3 PRs were rolled into the first, which I could then approve, and merge once CI had passed :)

Here’s the script (also on Gist), which depends on having the gh command line tool installed, and that’s run from the root of a clone of the repo concerned (I keep the script itself in ~/.local/bin/, but obviously anywhere on the PATH will be fine):

if [ $# -ne 2 ] ; then
    echo "Usage <BASE_PR> <LAST_PR>"
    exit 1
git pull
gh pr checkout "$BASE_PR"
for (( i=(($BASE_PR + 1)); i<=$LAST_PR; i++ ))
   PR_BRANCH=$(gh pr view "$i" --json headRefName -q .headRefName)
   git merge origin/"$PR_BRANCH" -m "build(deps): Merge branch for #{$i} {$PR_BRANCH}"
git push

It would still be nicer to say ‘@dependabot rollup #1247-1250‘ but for now that little script achieves the same outcome. 

No Responses Yet to “Roll up, rollup, get your Dependabot PRs together here”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: