Skip to content

Allowed unrelated histories #4

Allowed unrelated histories

Allowed unrelated histories #4

Workflow file for this run

name: Recursive Merge
on:
push:
branches:
- release/3
- release/2
jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Merge branch
id: merge
run: |
BRANCH=$(echo "${{ github.ref }}" | sed 's/refs\/heads\///')
echo "Current branch: $BRANCH"
if [[ "$BRANCH" == "release/3" ]]; then
TARGET_BRANCH="release/2"
elif [[ "$BRANCH" == "release/2" ]]; then
TARGET_BRANCH="release/1"
else
echo "Branch $BRANCH is not configured for recursive merging"
exit 1
fi
echo "Running git fetch..."
git fetch origin $TARGET_BRANCH
echo "Done. Running git checkout..."
git checkout $TARGET_BRANCH
echo "Done. Running git merge..."
git merge --no-ff --no-edit $BRANCH --allow-unrelated-histories
echo "Done. Running git push..."
git push origin $TARGET_BRANCH
- name: Check if merge was successful
if: steps.merge.outcome == 'success'
run: echo "Merge to $TARGET_BRANCH was successful"