From 90a28f615f9062e0135455b9129087c6251781b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20He=C3=9Felmann?= Date: Sat, 29 Jun 2024 03:42:55 +0200 Subject: [PATCH] fix: branch sync workflow --- .github/workflows/automerge.yaml | 2 +- .github/workflows/sync-prod-from-stage.yaml | 16 ++++++++++++++-- .github/workflows/sync-stage-from-master.yaml | 16 ++++++++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml index db2b4536..9d79c96d 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/automerge.yaml @@ -30,4 +30,4 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" MERGE_METHOD: merge - MERGE_FILTER_AUTHOR: github-actions + MERGE_FILTER_AUTHOR: github-actions[bot] diff --git a/.github/workflows/sync-prod-from-stage.yaml b/.github/workflows/sync-prod-from-stage.yaml index 6ca85227..e1066a6e 100644 --- a/.github/workflows/sync-prod-from-stage.yaml +++ b/.github/workflows/sync-prod-from-stage.yaml @@ -1,19 +1,31 @@ name: Sync stage -> production on: workflow_dispatch: +permissions: + # Needed to read branches. + contents: read + # Needed to create PR's. + pull-requests: write jobs: sync-branches: + permissions: + pull-requests: write runs-on: ubuntu-latest name: Syncing branches steps: - name: Checkout uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 - name: Opening pull request id: pull - # Need master for LABELS option. - uses: tretuna/sync-branches@master + uses: jdtx0/branch-sync@v1.5.1 with: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} FROM_BRANCH: "stage" TO_BRANCH: "production" LABELS: '["automerge"]' + PULL_REQUEST_AUTO_MERGE_METHOD: "merge" + PULL_REQUEST_IS_DRAFT: true diff --git a/.github/workflows/sync-stage-from-master.yaml b/.github/workflows/sync-stage-from-master.yaml index 3e3b71fc..950fbd54 100644 --- a/.github/workflows/sync-stage-from-master.yaml +++ b/.github/workflows/sync-stage-from-master.yaml @@ -1,19 +1,31 @@ name: Sync master -> stage on: workflow_dispatch: +permissions: + # Needed to read branches. + contents: read + # Needed to create PR's. + pull-requests: write jobs: sync-branches: + permissions: + pull-requests: write runs-on: ubuntu-latest name: Syncing branches steps: - name: Checkout uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 - name: Opening pull request id: pull - # Need master for LABELS option. - uses: tretuna/sync-branches@master + uses: jdtx0/branch-sync@v1.5.1 with: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} FROM_BRANCH: "master" TO_BRANCH: "stage" LABELS: '["automerge"]' + PULL_REQUEST_AUTO_MERGE_METHOD: "merge" + PULL_REQUEST_IS_DRAFT: true