Skip to content

Commit 6500218

Browse files
authored
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
1 parent 9ffeb69 commit 6500218

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

.github/workflows/benchmark.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ jobs:
1818
steps:
1919
- name: Incoming Pull Request
2020
if: |
21-
github.event_name == 'pull_request' || (
21+
(
22+
github.event_name == 'pull_request' &&
23+
github.event.pull_request.head.repo.full_name == 'npm/cli'
24+
) || (
2225
github.event_name == 'issue_comment' &&
2326
github.event.issue.pull_request &&
2427
github.event.issue.state == 'open' &&
2528
startsWith(github.event.comment.body, '@npm-cli-bot benchmark this')
2629
)
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.BENCHMARK_DISPATCH_TOKEN }}
2930
uses: actions/github-script@v6
3031
with:
32+
github-token: ${{ secrets.BENCHMARK_DISPATCH_TOKEN }}
3133
script: |
3234
const {
3335
payload,
@@ -36,11 +38,6 @@ jobs:
3638
issue: { number },
3739
} = context
3840
39-
if (eventName === 'pull_request' && !process.env.GITHUB_TOKEN) {
40-
core.info('No GITHUB_TOKEN - from fork pull request, exiting')
41-
return
42-
}
43-
4441
if (eventName === 'issue_comment') {
4542
const res = await github.rest.repos.getCollaboratorPermissionLevel({
4643
owner,

0 commit comments

Comments
 (0)