Created
September 21, 2022 00:31
-
-
Save yuekui/49e17df9626ed38c982ef98026fb2d35 to your computer and use it in GitHub Desktop.
Automatically sync branches via Github Action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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