Skip to content

Instantly share code, notes, and snippets.

@gries
Created November 18, 2020 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gries/41358014755ee28323c49deb03fd6988 to your computer and use it in GitHub Desktop.
Save gries/41358014755ee28323c49deb03fd6988 to your computer and use it in GitHub Desktop.
A simple bash script to move all open PRs from master to main
#!/bin/bash
# get all open PR numbers that have master as base
PRS=`gh pr list --state open --base master | cat | cut -f 1`
for PR_ID in $PRS; do
echo "PR: $PR_ID"
# Migrate pull-request to main branch
gh api -F base='main' -X PATCH /repos/gries/api-platform/pulls/$PR_ID > /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment