ci: comment review-binary download link on PRs, add Windows build#57
Merged
Conversation
CI already cross-compiled review binaries for every PR, but nothing linked them, so trying a PR before merge meant knowing to dig through the Actions run page. Post the link automatically instead. Contributor PRs come from forks, and fork PRs get a read-only GITHUB_TOKEN, so a comment step inside CI cannot post. This runs as a separate workflow_run workflow in the base-repo context, where the token is writable. It never checks out or executes PR code — it only reads run metadata and comments — so the writable token is never exposed to untrusted input. Also adds windows/amd64 to the cross-compile matrix. Goreleaser has always shipped a Windows binary for releases, but CI built darwin and linux only, so Windows users had nothing to test with. The reporter of #55 is on Windows. The comment is sticky: --edit-last updates the existing comment rather than stacking one per push, falling back to a new comment when there is none. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013JJnPtEtP97to9Rv2QMoer
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.
Problem
CI has cross-compiled review binaries for every PR since v1.2.0, but nothing ever linked to them — you had to know they existed and go dig through the Actions run page. So "try this before we merge it" was harder than it needed to be, especially for a drive-by contributor or an issue reporter who just wants to confirm their bug is gone.
Change
A
workflow_runworkflow posts a sticky comment with the download link once CI succeeds on a PR:Also adds windows/amd64 to the cross-compile matrix. Goreleaser has always shipped a Windows binary for tagged releases, but CI built darwin and linux only — so Windows users had nothing to test with. The reporter of #55 is on Windows, which is what surfaced this.
Why workflow_run instead of a step in CI
Contributor PRs come from forks (#52, #53, #54 all did), and fork PRs get a read-only
GITHUB_TOKEN— a comment step inside the CI job physically cannot post.workflow_runruns in the base-repo context where the token is writable.The usual hazard with that pattern is handing a writable token to untrusted code. This job avoids it structurally: it has no
actions/checkout, builds nothing, and runs nothing from the PR. It reads run metadata and posts a comment, full stop. The binaries are still built in the ordinarypull_requestjob with a read-only token.workflow_run.pull_requestsis empty for fork PRs, so the PR number is resolved from the head SHA via the commits API.Verification
filereportsPE32+ executable (console) x86-64, for MS Windows.${HEAD_SHA:0:7}truncation both render correctly.This PR cannot demonstrate itself.
workflow_runworkflows only fire when present on the default branch, so no comment will appear here — it starts working on the next PR after this merges. Worth knowing before you look for a bot comment that isn't coming.Caveats
retention-dayssetting, unchanged).🤖 Generated with Claude Code
https://claude.ai/code/session_013JJnPtEtP97to9Rv2QMoer