AAP-48139 add branch sync between release_4.6 and stable-2.6 (#6982)

* add branch sync between release_4.6 and stable-2.6

* add a new workflow to force push commits in release_4.6 to
  stable-2.6

* Update workflow to use matrix keyword


---------

Co-authored-by: Jake Jackson
This commit is contained in:
Jake Jackson
2025-06-30 19:56:08 -04:00
committed by GitHub
parent 1afd23043d
commit ec0732ce94

View File

@@ -1,4 +1,4 @@
name: Rebase release_4.6 into release_4.6-next nname: Rebase release_4.6-next and stable-2.6
on: on:
push: push:
@@ -12,41 +12,41 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
strategy:
matrix:
target_branch:
- release_4.6-next
- stable-2.6
steps: steps:
- name: Checkout release_4.6-next Branch - name: Checkout ${{ matrix.target_branch }} Branch
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: release_4.6-next ref: ${{ matrix.target_branch }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch release_4.6 Branch - name: Fetch release_4.6 Branch for ${{ matrix.target_branch }}
run: git fetch origin release_4.6:release_4.6 run: git fetch origin release_4.6:release_4.6
- name: Attempt Rebase - name: Attempt Rebase release_4.6 into ${{ matrix.target_branch }}
id: rebase_attempt # Give this step an something to reference its outcome id: rebase_attempt
run: | run: |
git config user.name "GitHub Actions" git config user.name "GitHub Actions"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout release_4.6-next git checkout ${{ matrix.target_branch }}
# 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 git rebase release_4.6 || true
continue-on-error: true # Allow this step to fail without stopping the workflow immediately continue-on-error: true # Allow this step to fail without stopping the workflow immediately
- name: Check for Conflicts and Abort if Necessary - name: Check for Conflicts and Abort if Necessary for ${{ matrix.target_branch }}
run: | run: |
# Check if there are any unmerged paths (i.e., conflicts)
if git status --porcelain | grep "^UU"; then if git status --porcelain | grep "^UU"; then
echo "::error::Rebase failed due to merge conflicts. Aborting rebase." echo "::error::Rebase failed for ${{ matrix.target_branch }} due to merge conflicts. Aborting rebase."
git rebase --abort git rebase --abort
exit 1 # Fail the job explicitly exit 1 # Fail the job explicitly
else else
echo "Rebase completed without conflicts." echo "Rebase for ${{ matrix.target_branch }} completed without conflicts."
fi fi
- name: Force Push Rebased release_4.6-next Branch - name: Force Push Rebased ${{ matrix.target_branch }} Branch
# Only run this step if the previous steps succeeded (no conflicts)
if: success() && steps.rebase_attempt.outcome != 'failure' if: success() && steps.rebase_attempt.outcome != 'failure'
run: | run: |
git push --force origin release_4.6-next git push --force origin ${{ matrix.target_branch }}