From 4b8da9de318869a2683fdb07bc42b6833b982782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sumire=20=28=E8=8F=AB=29?= <151038614+sumire88@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:08:59 -0500 Subject: [PATCH 1/2] ci: rework automerge-sync-pr workflow --- .github/workflows/automerge-sync-pr.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/automerge-sync-pr.yml b/.github/workflows/automerge-sync-pr.yml index 4b996c2..6b08452 100644 --- a/.github/workflows/automerge-sync-pr.yml +++ b/.github/workflows/automerge-sync-pr.yml @@ -1,12 +1,12 @@ -name: Auto merge changes made to the target branches in a pull request +name: Auto merge upstream changes made in a PR to the main branch on: - workflow_dispatch: - inputs: - pr_number: - description: Pull request number - required: true - type: string + workflow_run: + workflows: + - Eval + - Lint + types: + - completed jobs: sync-changes: @@ -15,6 +15,11 @@ jobs: contents: write pull-requests: write steps: + - name: Get Pull Request Number + id: get_pr_number + run: | + echo "PR_NUMBER=$(jq -r '.workflow_run.pull_requests[0].number' "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV + - name: Generate GitHub Auth Token # https://github.com/tibdex/github-app-token id: generate_token @@ -22,7 +27,7 @@ jobs: with: app_id: ${{ secrets.GH_APP_ID }} private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} - + - name: Auto merge changes in the target PR id: automerge # https://github.com/pascalgn/automerge-action @@ -32,7 +37,7 @@ jobs: MERGE_LABELS: automerge MERGE_REMOVE_LABELS: automerge MERGE_METHOD: squash - MERGE_COMMIT_MESSAGE: "ci(github-action): auto merge ${{ inputs.pr_number }}" + MERGE_COMMIT_MESSAGE: "ci(github-action): auto merge #${{ env.PR_NUMBER }}" MERGE_FORKS: false MERGE_RETRIES: 0 MERGE_RETRY_SLEEP: 0 From 11f44ea96fc8657844e4f5f3bfdd6f6f3f5ba291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sumire=20=28=E8=8F=AB=29?= <151038614+sumire88@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:41:15 -0500 Subject: [PATCH 2/2] ci: update trigger condition --- .github/workflows/automerge-sync-pr.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/automerge-sync-pr.yml b/.github/workflows/automerge-sync-pr.yml index 6b08452..60771c8 100644 --- a/.github/workflows/automerge-sync-pr.yml +++ b/.github/workflows/automerge-sync-pr.yml @@ -1,12 +1,12 @@ -name: Auto merge upstream changes made in a PR to the main branch +name: Auto merge sync PR on: - workflow_run: - workflows: - - Eval - - Lint - types: - - completed + workflow_dispatch: + inputs: + pr_number: + description: Pull request number + required: true + type: string jobs: sync-changes: @@ -15,11 +15,6 @@ jobs: contents: write pull-requests: write steps: - - name: Get Pull Request Number - id: get_pr_number - run: | - echo "PR_NUMBER=$(jq -r '.workflow_run.pull_requests[0].number' "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV - - name: Generate GitHub Auth Token # https://github.com/tibdex/github-app-token id: generate_token @@ -27,7 +22,7 @@ jobs: with: app_id: ${{ secrets.GH_APP_ID }} private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} - + - name: Auto merge changes in the target PR id: automerge # https://github.com/pascalgn/automerge-action @@ -37,7 +32,7 @@ jobs: MERGE_LABELS: automerge MERGE_REMOVE_LABELS: automerge MERGE_METHOD: squash - MERGE_COMMIT_MESSAGE: "ci(github-action): auto merge #${{ env.PR_NUMBER }}" + MERGE_COMMIT_MESSAGE: "ci(github-action): auto merge #${{ inputs.pr_number }}" MERGE_FORKS: false MERGE_RETRIES: 0 MERGE_RETRY_SLEEP: 0