From ea10c5a472b66965323d9db0a7711a8937ed93c7 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 23 Sep 2024 12:28:02 -0400 Subject: [PATCH] feat: add Gitflow workflow for syncing branches --- .github/workflows/sync-branches.yml | 50 ++++++++--------------------- 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/.github/workflows/sync-branches.yml b/.github/workflows/sync-branches.yml index a06b683eb..6de448944 100644 --- a/.github/workflows/sync-branches.yml +++ b/.github/workflows/sync-branches.yml @@ -1,45 +1,21 @@ -name: Sync Branches - +name: Gitflow Sync on: + # To create pull requests. push: - tags: - - "*" + # To merge pull requests if not possible during the push run. Remove if `auto-merge` is `false`. + pull_request_review: + check_run: + types: [completed] permissions: - contents: write + contents: read + pull-requests: write jobs: - sync-branches: - runs-on: ubuntu-latest + build: + name: Gitflow + runs-on: ubuntu-16.04 steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: Logerfo/gitflow-action@0.0.5 with: - fetch-depth: 0 - - - name: Check if tag is on develop or master - id: check-branch - run: | - if git branch -r --contains ${{ github.ref }} | grep -q 'origin/develop\|origin/master'; then - echo "SYNC_NEEDED=true" >> $GITHUB_OUTPUT - else - echo "SYNC_NEEDED=false" >> $GITHUB_OUTPUT - fi - - - name: Sync develop to master - if: steps.check-branch.outputs.SYNC_NEEDED == 'true' - uses: devmasx/merge-branch@master - with: - type: now - from_branch: develop - target_branch: master - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Sync master back to develop - if: steps.check-branch.outputs.SYNC_NEEDED == 'true' - uses: devmasx/merge-branch@master - with: - type: now - from_branch: master - target_branch: develop - github_token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} # The `GITHUB_TOKEN` secret.