Skip to content

Commit 254f2f7

Browse files
authored
fix: use GITHUB_TOKEN for non-baseline regression benchmark runs (#1514)
1 parent ffcf151 commit 254f2f7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/hh3-regression-benchmark.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ jobs:
8888
# are comparable to Hardhat's own regression baselines.
8989
runs-on: hardhat-linux-amd64-self-hosted
9090
timeout-minutes: 180
91+
permissions:
92+
# Lets the short-lived GITHUB_TOKEN used on non-baseline runs read commit
93+
# metadata via the REST API (see "Store benchmark result").
94+
contents: read
9195
env:
9296
# Hardhat is checked out into ./hardhat; the EDR repo is the workspace root.
9397
HH: ${{ github.workspace }}/hardhat
@@ -330,7 +334,12 @@ jobs:
330334
gh-repository: github.com/nomic-foundation-automation/edr-benchmark-results
331335
gh-pages-branch: main
332336
benchmark-data-dir-path: hardhat3
333-
github-token: ${{ secrets.BENCHMARK_GITHUB_TOKEN }}
337+
# Baseline (main push) runs push to the external results repo, which
338+
# needs the cross-repo PAT. Non-baseline runs (PR/dispatch and the
339+
# `/bench` issue_comment path) never push — the token is only used to
340+
# read commit metadata and to clone the (public) results repo for
341+
# comparison — so use the short-lived GITHUB_TOKEN.
342+
github-token: ${{ needs.setup.outputs.is_baseline == 'true' && secrets.BENCHMARK_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
334343
# Only push a new baseline on main-branch pushes; PRs/dispatch only compare.
335344
auto-push: ${{ needs.setup.outputs.is_baseline == 'true' }}
336345
alert-threshold: "110%"

0 commit comments

Comments
 (0)