ci(benchmarks): split commit/push out of bench job#14480
Open
emmajam wants to merge 1 commit intofoundry-rs:masterfrom
Open
ci(benchmarks): split commit/push out of bench job#14480emmajam wants to merge 1 commit intofoundry-rs:masterfrom
emmajam wants to merge 1 commit intofoundry-rs:masterfrom
Conversation
The benchmarks workflow was failing on the 'Commit and read benchmark
results' step with:
fatal: could not read Username for 'https://github.com'
The bench job checks out with persist-credentials: false (correctly,
since it executes untrusted third-party builds via foundryup and forge
against external repos), so 'git push' had no auth and exited 128.
Rather than re-enable persist-credentials on the self-hosted runner —
which would park a contents:write token alongside untrusted code — this
splits responsibilities cleanly:
* run-benchmarks (foundry-runner): runs benches, uploads artifact,
exposes pr_comment as a job output. Permissions reduced to
contents: read. No git writes.
* publish-results (ubuntu-latest): downloads artifact, commits
benches/LATEST.md, pushes the branch, and (for workflow_dispatch)
opens the results PR / comments on the target PR. This is the only
job with contents: write.
The single commit-and-read-benchmarks.sh script is split to match:
* read-benchmark-results.sh — pure read, emits GitHub Actions outputs.
* commit-benchmark-results.sh — branch creation, commit, push.
Also removes the duplicate 'Push branch for manual runs' step in
publish-results that was attempting to push a branch which had never
been created on the publish runner.
Amp-Thread-ID: https://ampcode.com/threads/T-019dd30a-bf52-745c-a966-e06f0e6cf363
Co-authored-by: Amp <amp@ampcode.com>
mablr
approved these changes
Apr 28, 2026
zerosnacks
reviewed
Apr 28, 2026
|
|
||
| ITHACAXYZ_ACCOUNT: "ithacaxyz/account:v0.3.2" | ||
| VECTORIZED_SOLADY: "Vectorized/solady:v0.1.22" | ||
| DEFAULT_REPOS: "ithacaxyz/account:v0.3.2,Vectorized/solady:v0.1.22" |
Member
There was a problem hiding this comment.
This looks like a regression, we need to retain the changes @mablr made
Collaborator
There was a problem hiding this comment.
foundry/.github/workflows/benchmarks.yml
Lines 23 to 54 in 12642e3
zerosnacks
requested changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The
Foundry Benchmarksworkflow has been failing on the Commit and read benchmark results step (example run):The bench job (
run-benchmarks) checks out withpersist-credentials: false(correctly so — it then executes untrusted third-party builds viafoundryupandforgeagainst external repos likeithacaxyz/accountandVectorized/solady), so the in-scriptgit pushhad no token and exited 128.The minimal fix would be
persist-credentials: trueon that checkout, but that permanently parks acontents: writeGitHub token on the self-hosted runner alongside untrusted code — not a tradeoff worth one line.Solution
Split responsibilities cleanly between the two existing jobs:
run-benchmarks(self-hostedfoundry-runner): runs benches, uploads artifact, exposespr_commentas a job output. Permissions reduced tocontents: read. No git writes.publish-results(ubuntu-latest): downloads the artifact, commitsbenches/LATEST.md, pushes the branch, and (forworkflow_dispatch) opens the results PR / comments on the target PR. This is the only job withcontents: write.commit-and-read-benchmarks.shis split to match its new homes:read-benchmark-results.sh— pure read, emits GitHub Actions outputs.commit-benchmark-results.sh— branch creation, commit, push.Also removes the duplicate Push branch for manual runs step in
publish-resultsthat was attempting to push a branch which had only ever existed on the bench runner.Why this is better long term
foundryup's install path) can no longer reach a write-scoped token, since the bench job has none. The blast radius shrinks to the lightweightubuntu-latestjob that only touches the artifact.publish-resultsremoves the duplication and the broken second push.publish-resultscan be re-run independently without spending another 30+ minutes regenerating numbers.PR Checklist