Skip to content

Instantly share code, notes, and snippets.

@yuekui
Created September 21, 2022 00:31
Show Gist options
  • Save yuekui/49e17df9626ed38c982ef98026fb2d35 to your computer and use it in GitHub Desktop.
Save yuekui/49e17df9626ed38c982ef98026fb2d35 to your computer and use it in GitHub Desktop.
Automatically sync branches via Github Action
name: Sync branches master -> release -> develop
on:
push:
branches:
- release
- master
jobs:
sync-release:
name: Sync branches after a PR was merged
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: decide target branch
id: set-target-branch
run: |
if [[ ${{ github.ref_name }} == 'master' ]]; then
echo "::set-output name=target-branch::release"
else
echo "::set-output name=target-branch::develop"
fi
- name: merge branch to target
uses: mtanzi/action-automerge@v1
with:
github_token: ${{ secrets.REPO_PAT }}
source: ${{ github.ref_name }}
target: ${{ steps.set-target-branch.outputs.target-branch }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment