Repository navigation
ci: post version suggestions via workflow_run instead of pull_request_target - #229
Merged
Merged
Conversation
…_target GitHub blocks pull_request_target by default on public repositories since 2026-12-02, so every Version suggestion run has been a startup_failure. Split the job: version-suggestion.yml now runs on pull_request with a read-only token, computes the suggestion and uploads it as an artifact; the new version-suggestion-comment.yml runs on workflow_run, validates the artifact and that its PR matches the run's head commit, and posts the comment. Fork PRs keep working (#115) without an admin policy. Co-Authored-By: Adam J Esslinger <esslinger@gmail.com>
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.
Why
Every Version suggestion run since 2026-12-03 has ended in
startup_failure. The run page explains why: "GitHub restrictspull_request_targeton public repositories by default. To allow the event trigger, configure an Actions policy." GitHub turned this on for public repos on 2026-12-02. Allowing the trigger again needs a repo or org admin to add an Actions event policy. This PR removes the need for that trigger instead.What
The job is split into two workflows, GitHub's recommended pattern for this case:
version-suggestion.ymlnow runs onpull_requestwithcontents: read.version-suggestionartifact (suggestion.json) instead of commenting.version-suggestion-comment.yml(new) runs onworkflow_runwhen that workflow completes.A fork PR's run can influence the artifact, so the comment job checks it before posting anything:
head_sha, with basemain.Testing
actionlintis clean apart from two existing shellcheck style notes in the unchanged classify script, which are also present onmain.Caveat: a
workflow_runworkflow only fires from the default branch. On this PR, thepull_requesthalf runs and uploads the artifact, but the comment won't appear until after merge. The first PR opened after merging is the end-to-end test.