Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🍒 7896] Add support for multiple commits PR backport #7902

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tooling/backport-pr-to-patch-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ git fetch --quiet
git show-ref --verify --quiet "refs/remotes/origin/$PATCH_RELEASE_BRANCH" 1>/dev/null 2>&1 || { echo "Branch $PATCH_RELEASE_BRANCH does not exist"; exit 1; }
# Check PR exists
echo "- Checking PR exists"
PR_COMMIT=$(gh pr view "$PR_NUMBER" --json commits --jq '.commits[].oid')
if [ -z "$PR_COMMIT" ]; then
PR_COMMITS=$(gh pr view "$PR_NUMBER" --json commits --jq '.commits[].oid')
if [ -z "$PR_COMMITS" ]; then
echo "PR $PR_NUMBER does not exist"
exit 1
fi
Expand All @@ -68,8 +68,10 @@ git pull
# Create a new branch for the backport
BRANCH_NAME="$USER/backport-pr-$PR_NUMBER"
git checkout -b "$BRANCH_NAME"
# Cherry-pick PR commit
git cherry-pick "$PR_COMMIT"
# Cherry-pick PR commits
for PR_COMMIT in $PR_COMMITS; do
git cherry-pick -x "$PR_COMMIT"
done
# Push the branch
git push -u origin "$BRANCH_NAME" --no-verify
# Create a PR
Expand Down