Skip to content

Commit

Permalink
chore: benchmark script fixes (npm#6824)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lukekarrys committed Sep 20, 2023
1 parent 9ffeb69 commit 6500218
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 6500218

Please sign in to comment.