Skip to content

update sync action

update sync action #9

Workflow file for this run

name: Sync Branch if postfix in name
on:
push:
branches:
- '*'
jobs:
check_and_run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get current branch name
id: branch_name
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Determine parent branch
id: parent_branch
run: echo "PARENT_BRANCH=${BRANCH_NAME%-*}" >> $GITHUB_ENV
- name: Configure Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Safder Areepattamannil"
- name: Fetch latest changes
run: git fetch origin
- name: Merge changes into parent branch
if: ${{ contains(env.BRANCH_NAME, '-postfix') }}
run: |
git checkout ${{ env.BRANCH_NAME }}
git merge --allow-unrelated-histories --strategy-option=theirs origin/${{ env.PARENT_BRANCH }}
git push origin ${{ env.BRANCH_NAME }}