diff --git a/.github/workflows/pr_approval.yml b/.github/workflows/pr_approval.yml index fbac5035e2d3a..444773e2e6841 100644 --- a/.github/workflows/pr_approval.yml +++ b/.github/workflows/pr_approval.yml @@ -5,18 +5,22 @@ 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. # Source: https://stackoverflow.com/a/76994510 -permissions: write-all +permissions: + contents: write + actions: write + pull-requests: write + checks: write jobs: check-approvals: - if: github.event.review.state == 'APPROVED' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - name: Checkout repository @@ -51,23 +55,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');