From b9f47b46c8f7673fd2b61c8c6cbb70d599b25b12 Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Fri, 14 Jun 2024 23:34:13 +0800 Subject: [PATCH 1/8] =?UTF-8?q?[ISSUE=20#557]=F0=9F=94=A8Update=20automerg?= =?UTF-8?q?e.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/automerge.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 9692ce73..86f7a850 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -16,23 +16,9 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" MERGE_LABELS: "approved,auto merge" MERGE_METHOD: "squash" - MERGE_COMMIT_MESSAGE: "pull-request-title" + MERGE_COMMIT_MESSAGE: "automatic" MERGE_FORKS: "false" MERGE_RETRIES: "10" MERGE_RETRY_SLEEP: "20000" MERGE_REQUIRED_APPROVALS: "1" - UPDATE_METHOD: "rebase" - - - name: Add comment - if: ${{ steps.automerge.outputs.mergeResult == 'merged' }} - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { owner, repo, number: issue_number } = context.issue; - github.rest.issues.createComment({ - owner, - repo, - issue_number, - body: "๐Ÿš€This PR has been automatically merged with squash.๐Ÿš€" - }) \ No newline at end of file + UPDATE_METHOD: "rebase" \ No newline at end of file From 86f0871929640ee6da7cf2f26c78118000ace3c2 Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:01:21 +0800 Subject: [PATCH 2/8] fix ci --- .github/workflows/auto-comment-pr.yml | 1 - .github/workflows/automerge.yml | 2 ++ .github/workflows/label-on-approval.yml | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 6f8e19cf..35f49afc 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -15,7 +15,6 @@ jobs: - name: Create a comment uses: actions/github-script@v7 with: - github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo, number: issue_number } = context.issue; const commentBody = "Please review this PR."; diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 86f7a850..64fef2ba 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -12,6 +12,8 @@ jobs: steps: - name: automerge uses: "pascalgn/automerge-action@v0.16.3" + permissions: + contents: write env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" MERGE_LABELS: "approved,auto merge" diff --git a/.github/workflows/label-on-approval.yml b/.github/workflows/label-on-approval.yml index 3be18f9a..f18f2c0e 100644 --- a/.github/workflows/label-on-approval.yml +++ b/.github/workflows/label-on-approval.yml @@ -16,7 +16,6 @@ jobs: id: check_approval uses: actions/github-script@v7 with: - github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo } = context.repo; const { pull_request, review } = context.payload; From bc53b5c249f724643328463b2df37e44707d1427 Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:06:52 +0800 Subject: [PATCH 3/8] ccc --- .github/workflows/auto-comment-pr.yml | 1 + .github/workflows/automerge.yml | 4 +--- .github/workflows/label-on-approval.yml | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 35f49afc..6f8e19cf 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -15,6 +15,7 @@ jobs: - name: Create a comment uses: actions/github-script@v7 with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo, number: issue_number } = context.issue; const commentBody = "Please review this PR."; diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 64fef2ba..84aab965 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -12,13 +12,11 @@ jobs: steps: - name: automerge uses: "pascalgn/automerge-action@v0.16.3" - permissions: - contents: write env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" MERGE_LABELS: "approved,auto merge" MERGE_METHOD: "squash" - MERGE_COMMIT_MESSAGE: "automatic" + MERGE_COMMIT_MESSAGE: "pull-request-title" MERGE_FORKS: "false" MERGE_RETRIES: "10" MERGE_RETRY_SLEEP: "20000" diff --git a/.github/workflows/label-on-approval.yml b/.github/workflows/label-on-approval.yml index f18f2c0e..3be18f9a 100644 --- a/.github/workflows/label-on-approval.yml +++ b/.github/workflows/label-on-approval.yml @@ -16,6 +16,7 @@ jobs: id: check_approval uses: actions/github-script@v7 with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo } = context.repo; const { pull_request, review } = context.payload; From e3aabd879d46831fbb7e76f66920e2493a2a92ca Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:11:19 +0800 Subject: [PATCH 4/8] ttt --- .github/workflows/auto-comment-pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 6f8e19cf..6d045eb0 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -2,6 +2,7 @@ name: Auto Comment on PR on: pull_request: + branches: [ "main"] types: [ opened, synchronize ] jobs: From 6b5aa7ff7eef6c36a156783a0cfc7566395d7f0f Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:12:52 +0800 Subject: [PATCH 5/8] add --- .github/workflows/auto-comment-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 6d045eb0..344e7fd3 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -16,7 +16,7 @@ jobs: - name: Create a comment uses: actions/github-script@v7 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.PAT_TOKEN }} script: | const { owner, repo, number: issue_number } = context.issue; const commentBody = "Please review this PR."; From 45b5b84036cc2eff0a35c6c493194d7b6ba9d930 Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:26:48 +0800 Subject: [PATCH 6/8] tt --- .github/workflows/auto-comment-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 344e7fd3..7bb80bc3 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -1,7 +1,7 @@ name: Auto Comment on PR on: - pull_request: + pull_request_target: branches: [ "main"] types: [ opened, synchronize ] From 86f8d17f825fe025dbb57871af383f1011296ea7 Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:33:12 +0800 Subject: [PATCH 7/8] tttt --- .github/workflows/auto-comment-pr.yml | 1 - .github/workflows/auto_request_review.yml | 35 +++++++++++++---------- .github/workflows/automerge.yml | 4 +-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 7bb80bc3..44dd4634 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -2,7 +2,6 @@ name: Auto Comment on PR on: pull_request_target: - branches: [ "main"] types: [ opened, synchronize ] jobs: diff --git a/.github/workflows/auto_request_review.yml b/.github/workflows/auto_request_review.yml index 5949879a..44dd4634 100644 --- a/.github/workflows/auto_request_review.yml +++ b/.github/workflows/auto_request_review.yml @@ -1,22 +1,27 @@ -name: Auto Request Review +name: Auto Comment on PR on: - pull_request: - types: [ opened, ready_for_review, reopened, synchronize ] + pull_request_target: + types: [ opened, synchronize ] jobs: - auto-request-review: - name: Auto Request Review + comment: runs-on: ubuntu-latest + steps: - - name: Request review based on files changes and/or groups the author belongs to - uses: necojackarc/auto-request-review@v0.13.0 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create a comment + uses: actions/github-script@v7 with: - token: ${{ secrets.GITHUB_TOKEN }} - config: .github/reviewers.yml # Config file location override - # Look for config locally during run instead of in repo. - # For instance, if you'd like to use a config file stored in external storage, - # you can fetch it before you run this action, then let this action pick it up with `use_local: true`. - # This defaults to false if not specified. - # See https://github.com/necojackarc/auto-request-review/issues/76 for more details. - use_local: false \ No newline at end of file + github-token: ${{ secrets.PAT_TOKEN }} + script: | + const { owner, repo, number: issue_number } = context.issue; + const commentBody = "Please review this PR."; + github.rest.issues.createComment({ + owner, + repo, + issue_number, + body: commentBody + }); diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 84aab965..12e394b2 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,6 +1,6 @@ name: Auto Merge PR on: - pull_request: + pull_request_target: types: - labeled - synchronize @@ -13,7 +13,7 @@ jobs: - name: automerge uses: "pascalgn/automerge-action@v0.16.3" env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.PAT_TOKEN }}" MERGE_LABELS: "approved,auto merge" MERGE_METHOD: "squash" MERGE_COMMIT_MESSAGE: "pull-request-title" From efccc010d6864b64e27bc9801f442788faba2dab Mon Sep 17 00:00:00 2001 From: ButterflyEffect1991 <395967916@qq.com> Date: Sat, 15 Jun 2024 00:40:42 +0800 Subject: [PATCH 8/8] tttt --- .github/workflows/auto-comment-pr.yml | 4 ++-- .github/workflows/auto_request_review.yml | 4 ++-- .github/workflows/automerge.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-comment-pr.yml b/.github/workflows/auto-comment-pr.yml index 44dd4634..6f8e19cf 100644 --- a/.github/workflows/auto-comment-pr.yml +++ b/.github/workflows/auto-comment-pr.yml @@ -1,7 +1,7 @@ name: Auto Comment on PR on: - pull_request_target: + pull_request: types: [ opened, synchronize ] jobs: @@ -15,7 +15,7 @@ jobs: - name: Create a comment uses: actions/github-script@v7 with: - github-token: ${{ secrets.PAT_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo, number: issue_number } = context.issue; const commentBody = "Please review this PR."; diff --git a/.github/workflows/auto_request_review.yml b/.github/workflows/auto_request_review.yml index 44dd4634..6f8e19cf 100644 --- a/.github/workflows/auto_request_review.yml +++ b/.github/workflows/auto_request_review.yml @@ -1,7 +1,7 @@ name: Auto Comment on PR on: - pull_request_target: + pull_request: types: [ opened, synchronize ] jobs: @@ -15,7 +15,7 @@ jobs: - name: Create a comment uses: actions/github-script@v7 with: - github-token: ${{ secrets.PAT_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo, number: issue_number } = context.issue; const commentBody = "Please review this PR."; diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 12e394b2..8458774a 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -13,7 +13,7 @@ jobs: - name: automerge uses: "pascalgn/automerge-action@v0.16.3" env: - GITHUB_TOKEN: "${{ secrets.PAT_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" MERGE_LABELS: "approved,auto merge" MERGE_METHOD: "squash" MERGE_COMMIT_MESSAGE: "pull-request-title"