From dded6436abbcf24ee970ce495a43058c74d4232e Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Thu, 29 Feb 2024 13:02:06 +0800 Subject: [PATCH 1/2] chore: Only MEMBER and OWNER can package with comment. --- .github/workflows/package_for_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package_for_test.yml b/.github/workflows/package_for_test.yml index d73e821810..c54fd5d9b3 100644 --- a/.github/workflows/package_for_test.yml +++ b/.github/workflows/package_for_test.yml @@ -2,12 +2,12 @@ name: Package Neuron for Test on: issue_comment: - types: [created, edited] + types: [created] push: jobs: packaging: - if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package')) || github.event_name == 'push' }} + if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package') && contains(fromJSON('["MEMBER", "OWNER"]'), (github.event.comment.author_association))) || github.event_name == 'push' }} strategy: matrix: From ba80edd878e1e8ba9b0096962196755c6430b941 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Thu, 7 Mar 2024 15:00:54 +0800 Subject: [PATCH 2/2] chore: Add permissions for package test --- .github/workflows/package_for_test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/package_for_test.yml b/.github/workflows/package_for_test.yml index c54fd5d9b3..7ee9a30a46 100644 --- a/.github/workflows/package_for_test.yml +++ b/.github/workflows/package_for_test.yml @@ -20,6 +20,10 @@ jobs: runs-on: ${{ matrix.os }} + permissions: + contents: read + pull-requests: read + name: ${{ matrix.os }}(Node.js ${{ matrix.node }}) env: @@ -208,6 +212,9 @@ jobs: needs: [packaging] name: Append links to the Pull Request runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write steps: - name: Comment by push event if: ${{ github.event_name == 'push' }} @@ -230,6 +237,8 @@ jobs: if: ${{ always() && needs.packaging.result == 'failure' }} name: Append failed comment to the comment runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: Comment by pull request comment event when package failed if: ${{ github.event_name == 'issue_comment' }}