From 650021838ad0fe565f925b47dfd2ea65beefa4c5 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 20 Sep 2023 12:25:13 -0700 Subject: [PATCH] chore: benchmark script fixes (#6824) This passes the token to the github-script action and now skips the PR workflow for forks in the if statement instead of while running the script --- .github/workflows/benchmark.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 0560d2ceb1415..3cd5054dac537 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -18,16 +18,18 @@ jobs: steps: - name: Incoming Pull Request if: | - github.event_name == 'pull_request' || ( + ( + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == 'npm/cli' + ) || ( github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.issue.state == 'open' && startsWith(github.event.comment.body, '@npm-cli-bot benchmark this') ) - env: - GITHUB_TOKEN: ${{ secrets.BENCHMARK_DISPATCH_TOKEN }} uses: actions/github-script@v6 with: + github-token: ${{ secrets.BENCHMARK_DISPATCH_TOKEN }} script: | const { payload, @@ -36,11 +38,6 @@ jobs: issue: { number }, } = context - if (eventName === 'pull_request' && !process.env.GITHUB_TOKEN) { - core.info('No GITHUB_TOKEN - from fork pull request, exiting') - return - } - if (eventName === 'issue_comment') { const res = await github.rest.repos.getCollaboratorPermissionLevel({ owner,