Skip to content

Post the benchmark PR comment (both benchmarks) for fork PRs too#239

Merged
NullVoxPopuli merged 1 commit into
ember-tooling:mainfrom
NullVoxPopuli-ai-agent:ci/bench-comment-fork-prs
Jul 6, 2026
Merged

Post the benchmark PR comment (both benchmarks) for fork PRs too#239
NullVoxPopuli merged 1 commit into
ember-tooling:mainfrom
NullVoxPopuli-ai-agent:ci/bench-comment-fork-prs

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown

Since #236 the Benchmark Comparison workflow generates a two-section comment (Parse + Project mode (type-aware)), but for fork PRs the pull_request token is read-only, so the posting step skipped and the results were only reachable through the workflow job summary — e.g. #235 never got its benchmark comment despite the job producing one.

This splits posting into the standard two-workflow pattern:

  • bench-compare.yml (unprivileged, runs PR code): formats the comment as before, then uploads it plus the PR number as a bench-comment artifact instead of posting.
  • bench-comment.yml (new, workflow_run on "Benchmark Comparison", pull-requests: write): downloads the artifact and creates/updates the marker-managed comment. One code path for fork and same-repo PRs.

Security

The privileged workflow never checks out or executes PR code. The artifact is treated as data:

  • the PR number is validated as a positive integer, and the named PR's head.sha must match the triggering run's head_sha (a fork can't redirect its comment onto another PR);
  • the body is passed to the GitHub API as text only (never a shell/script context), truncated at the 65k comment cap.

Notes

  • workflow_run workflows execute from the default branch's definition, so this takes effect for runs triggered after this merges. The next push to any open PR (including fork PRs like Graft .gts SourceFiles onto every virtual twin, once per program #235) will then get the two-benchmark comment.
  • The failure path is preserved: the bench job's if: always() formatting still produces the "❌ failed" comment body, which now also gets posted for fork PRs.

🤖 Generated with Claude Code

bench-compare.yml runs on pull_request, where fork PRs receive a
read-only token — the two-section benchmark comment (parse + project
mode) was generated but only reachable through the job summary.

Split posting into bench-comment.yml, triggered by workflow_run with
pull-requests: write. The bench job uploads the formatted comment and
PR number as an artifact; the privileged workflow downloads it,
validates the named PR's head SHA against the triggering run, and
creates/updates the marker-managed comment. One code path for fork and
same-repo PRs; the write-token workflow never executes PR code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@NullVoxPopuli NullVoxPopuli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GH correctly didn't run the workflow because it isn't on main yet

@NullVoxPopuli NullVoxPopuli merged commit de9ac2b into ember-tooling:main Jul 6, 2026
38 checks passed
@NullVoxPopuli NullVoxPopuli deleted the ci/bench-comment-fork-prs branch July 6, 2026 15:53
@github-actions github-actions Bot mentioned this pull request Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants