Skip to content

Instantly share code, notes, and snippets.

@cpswan

cpswan/rollup.sh Secret

Last active October 24, 2023 14:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpswan/1e61f12b4a83355a7560d96cb1cdf726 to your computer and use it in GitHub Desktop.
Save cpswan/1e61f12b4a83355a7560d96cb1cdf726 to your computer and use it in GitHub Desktop.
Script to rollup Dependabot pull requests on GitHub
#!/bin/bash
if [ $# -ne 2 ] ; then
echo "Usage rollup.sh <BASE_PR> <LAST_PR>"
exit 1
fi
BASE_PR=$1
LAST_PR=$2
git pull
gh pr checkout "$BASE_PR"
for (( i=(($BASE_PR + 1)); i<=$LAST_PR; i++ ))
do
PR_BRANCH=$(gh pr view "$i" --json headRefName -q .headRefName)
git merge origin/"$PR_BRANCH" -m "build(deps): Rollup merge branch for #${i} ${PR_BRANCH}"
done
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment