Add workflow to rebase release branches (#6968)

* Adds a workflow that rebases release_4.6 onto release_4.6-next
This commit is contained in:
Jake Jackson 2025-06-09 12:15:50 -04:00 committed by Hao Liu
parent f4347d05a9
commit d26c7fedb8
No known key found for this signature in database

View File

@ -0,0 +1,48 @@
name: Rebase release_4.6 into release_4.6-next
on:
push:
branches:
- release_4.6
workflow_dispatch:
# Allows manual triggering of the workflow from the GitHub UI
jobs:
rebase:
runs-on: ubuntu-latest
steps:
- name: Checkout release_4.6-next Branch
uses: actions/checkout@v4
with:
ref: release_4.6-next
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch release_4.6 Branch
run: git fetch origin release_4.6:release_4.6
- name: Attempt Rebase
id: rebase_attempt # Give this step an something to reference its outcome
run: |
git checkout release_4.6-next
# Attempt the rebase.
# The '|| true' allows the script to continue even if rebase fails,
# so we can check the status and then abort.
git rebase release_4.6 || true
continue-on-error: true # Allow this step to fail without stopping the workflow immediately
- name: Check for Conflicts and Abort if Necessary
run: |
# Check if there are any unmerged paths (i.e., conflicts)
if git status --porcelain | grep "^UU"; then
echo "::error::Rebase failed due to merge conflicts. Aborting rebase."
git rebase --abort
exit 1 # Fail the job explicitly
else
echo "Rebase completed without conflicts."
fi
- name: Force Push Rebased release_4.6-next Branch
# Only run this step if the previous steps succeeded (no conflicts)
if: success() && steps.rebase_attempt.outcome != 'failure'
run: |
git push --force origin release_4.6-next