From d26c7fedb863567a5f80e7940397c29b5d816d5f Mon Sep 17 00:00:00 2001 From: Jake Jackson Date: Mon, 9 Jun 2025 12:15:50 -0400 Subject: [PATCH] Add workflow to rebase release branches (#6968) * Adds a workflow that rebases release_4.6 onto release_4.6-next --- .github/workflows/feature_branch_sync.yml | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/feature_branch_sync.yml diff --git a/.github/workflows/feature_branch_sync.yml b/.github/workflows/feature_branch_sync.yml new file mode 100644 index 0000000000..517e9500c3 --- /dev/null +++ b/.github/workflows/feature_branch_sync.yml @@ -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