From 5e63b4cc46a6107b156acf6a46e89ebb8b4ba3ec Mon Sep 17 00:00:00 2001 From: Jaisurya Nanduri Date: Wed, 10 Jul 2024 22:45:13 +0000 Subject: [PATCH 1/3] test pr change --- .github/workflows/pr_approval.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_approval.yml b/.github/workflows/pr_approval.yml index fbac5035e2d3a..abb456623ffa7 100644 --- a/.github/workflows/pr_approval.yml +++ b/.github/workflows/pr_approval.yml @@ -5,9 +5,10 @@ name: Check PR Approvals # To protect against that scenario, we can turn on number of approvals required to 2 in the github settings # of the repository on: - pull_request_review: - types: [submitted] - workflow_dispatch: + pull_request: + # pull_request_review: + # types: [submitted] + # workflow_dispatch: # Without these permissions, we get a 403 error from github # for trying to modify the pull request for newer project. @@ -16,7 +17,6 @@ permissions: write-all jobs: check-approvals: - if: github.event.review.state == 'APPROVED' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - name: Checkout repository From 2852d9bd54db8808189ed9587e4e6132926e44f0 Mon Sep 17 00:00:00 2001 From: Jaisurya Nanduri Date: Wed, 10 Jul 2024 22:47:22 +0000 Subject: [PATCH 2/3] Remove relevance checks --- .github/workflows/pr_approval.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/pr_approval.yml b/.github/workflows/pr_approval.yml index abb456623ffa7..b97275a47ccb7 100644 --- a/.github/workflows/pr_approval.yml +++ b/.github/workflows/pr_approval.yml @@ -51,23 +51,6 @@ jobs: pull_number = context.issue.number; } - // Get PR files - const files = await github.rest.pulls.listFiles({ - owner, - repo, - pull_number - }); - - const relevantPaths = ['library/', 'doc/src/challenges/']; - const isRelevantPR = files.data.some(file => - relevantPaths.some(path => file.filename.startsWith(path)) - ); - - if (!isRelevantPR) { - console.log('PR does not touch relevant paths. Exiting workflow.'); - return; - } - // Get parsed data try { const tomlContent = fs.readFileSync('.github/pull_requests.toml', 'utf8'); From 6e79e30dd090c39b404a3309c2dec13f8ddc47e9 Mon Sep 17 00:00:00 2001 From: Jaisurya Nanduri Date: Wed, 10 Jul 2024 22:54:24 +0000 Subject: [PATCH 3/3] check with explicit write permissions --- .github/workflows/pr_approval.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_approval.yml b/.github/workflows/pr_approval.yml index b97275a47ccb7..444773e2e6841 100644 --- a/.github/workflows/pr_approval.yml +++ b/.github/workflows/pr_approval.yml @@ -13,7 +13,11 @@ on: # Without these permissions, we get a 403 error from github # for trying to modify the pull request for newer project. # Source: https://stackoverflow.com/a/76994510 -permissions: write-all +permissions: + contents: write + actions: write + pull-requests: write + checks: write jobs: check-approvals: