Repository navigation
bench-diff on pull_request - #330
Merged
Merged
Conversation
v1v
approved these changes
Oct 30, 2026
mallendem
enabled auto-merge (squash)
October 30, 2026 12:35
fr4nc1sc0-r4m0n
approved these changes
Oct 30, 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.
Switch
bench-difffrompull_request_targettopull_request.Why
bench-diff.ymlchecked out the PR head SHA and rango test -benchon it underpull_request_target, with achecks: writetoken. The fork gate was thesafe-to-testlabel, but the trigger includedsynchronize. Once a fork PR was labelled, every later push ran unreviewed code with that token (label TOCTOU). Event data was also interpolated directly inrun:. Benchmarks need no secrets, sopull_requestis enough.Changes (
.github/workflows/bench-diff.yml)pull_request_target(labeled, synchronize) becomespull_request.pushis kept.safe-to-test/ forkif:gate and the "Get sha commit" step, which had${{ }}insiderun:. The checkout ref is nowgithub.event.pull_request.head.sha || github.sha, the same SHA as before.actions/checkoutandactions/setup-goare pinned by SHA with version comments (v7.0.1 and v7.0.0, the latest releases).benchdiff-actionwas already pinned (v0.3.5, still the latest).report_statusistrueonly onpush. The check-run is POSTed by the action with the job token, which is read-only onpull_requestfrom forks and Dependabot.push, or onpull_requestonly for fork PRs: same-repo PRs are covered by thepushrun on the same SHA, so benchmarks are not run twice.Behaviour change
benchdiff-resultcheck-run any more. The results are in the job summary. Previously a labelled fork PR got the check-run.safe-to-testlabel: no longer used by this workflow (the label is still used elsewhere in the repo's history, and it can be deleted).pushrun for the branch, on the head commit, so it still shows on the PR. Thepull_requestrun does not run for same-repo PRs (only for forks), so there are no duplicate benchmark runs.pushrun, as before. Thepull_requestrun is skipped for them (same-repo).pushto main and tags: unchanged.workflow_runworkflow could post the check-run for fork PRs without checking out PR code. I left it out because it needs artifact plumbing andbenchdiff-actionhas no "post only" mode.Required checks
benchdiff-resultandbench-diffare not required. Classic protection onmainrequireslint,CLAandrun-tests. The org rulesets (221698, 221255, 1225254, 221699) have no required status checks.Verification
Done:
gh apiagainst the release tags.benchdiff-actionsource (report-status.sh,run.sh) to confirm how the check-run is posted.Not done:
Part of the pull_request_target audit: https://github.com/elastic/observability-robots/issues/5292