| #!/bin/bash -xe |
| |
| # Clone the repository in a temporary directory if it doesn't exist |
| if [ ! -d "/tmp/vexxhost-${1}" ]; then |
| gh repo clone vexxhost/${1} /tmp/vexxhost-${1} |
| fi |
| |
| # Switch to the repository |
| cd /tmp/vexxhost-${1} |
| |
| # Update the repository |
| git fetch origin |
| |
| # Switch to the branch that we're cherry-picking into |
| git checkout -B backport/${3}/${2} origin/${3} |
| |
| # Cherry-pick the change |
| git cherry-pick -x ${2} |
| |
| # Push this branch to the remote |
| git push -u origin backport/${3}/${2} |
| |
| # Create a PR for this change |
| gh repo set-default vexxhost/${1} |
| gh pr create \ |
| --title "[${3}] $(git show -s --format=%s)" \ |
| --body "$(git show -s --format=%B)" \ |
| --base ${3} \ |
| --head backport/${3}/${2} |