Skip to content

Commit 974a5fc

Browse files
committed
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 a2cc6e1 commit 974a5fc

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

.github/workflows/benchmark.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +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-
# gh cli uses these env vars for owner/repo/token
29-
GH_REPO: "npm/benchmarks"
30-
GITHUB_TOKEN: ${{ secrets.BENCHMARK_DISPATCH_TOKEN }}
3130
uses: actions/github-script@v6
3231
with:
32+
github-token: ${{ secrets.BENCHMARK_DISPATCH_TOKEN }}
3333
script: |
3434
const {
3535
payload,
@@ -38,11 +38,6 @@ jobs:
3838
issue: { number },
3939
} = context
4040
41-
if (eventName === 'pull_request' && !process.env.GITHUB_TOKEN) {
42-
core.info('No GITHUB_TOKEN - from fork pull request, exiting')
43-
return
44-
}
45-
4641
if (eventName === 'issue_comment') {
4742
const res = await github.rest.repos.getCollaboratorPermissionLevel({
4843
owner,

0 commit comments

Comments
 (0)