blob: af1508aadc9ca6f4e6fdaa4b273cda7ea8907782 [file] [log] [blame]
Mohammed Naser94a8cb92023-02-19 20:42:58 +00001#!/bin/bash -xe
2
3# Clone the repository in a temporary directory if it doesn't exist
4if [ ! -d "/tmp/openstack-${1}" ]; then
5 gh repo clone vexxhost/${1} /tmp/openstack-${1}
6fi
7
8# Switch to the repository
9cd /tmp/openstack-${1}
10
11# Update the repository
12git fetch origin
13
14# Switch to the branch that we're cherry-picking into
15git checkout -B backport/${3}/${2} origin/${3}
16
17# Cherry-pick the change
18git cherry-pick -x ${2}
19
20# Push this branch to the remote
21git push -u origin backport/${3}/${2}
22
23# Create a PR for this change
24gh repo set-default vexxhost/${1}
25gh pr create \
26 --title "[${3}] $(git show -s --format=%s)" \
27 --body "$(git show -s --format=%B)" \
28 --base ${3} \
29 --head backport/${3}/${2}