Fix broken PR workflow around API diffs for fork PRs - #2291
Merged
Jevan Saks (jevansaks) merged 2 commits intoAug 25, 2026
Merged
Conversation
Skip API diff comment steps for cross-repository pull requests, whose GITHUB_TOKEN is read-only, while preserving validation and artifact uploads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c89a1dcf-0af3-4f7c-ad60-69a9866eeffd
Move PR comment publishing to a trusted workflow_run workflow that consumes the validation artifact without executing contributor code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c89a1dcf-0af3-4f7c-ad60-69a9866eeffd
Jevan Saks (jevansaks)
marked this pull request as ready for review
August 25, 2026 02:18
Jevan Saks (jevansaks)
requested review from
a team and
Vineeth Thomas Alex (vineeththomasalex)
as code owners
August 25, 2026 02:18
Jevan Saks (jevansaks)
enabled auto-merge (squash)
August 25, 2026 02:20
Manodasan Wignarajah (manodasanW)
approved these changes
Aug 25, 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.
Summary
pull_requestsecurity boundary.workflow_runworkflow to download that artifact and post or update the API-diff PR comment for both fork and same-repository contributions.Why
Fork PR workflows receive a read-only
GITHUB_TOKEN, even when the workflow requestspull-requests: write. The validation in #2290 completed successfully, then the no-diff comment step failed with403 Resource not accessible by integration.Granting the untrusted PR workflow write access would be unsafe. The split workflow follows GitHub's recommended pattern: untrusted code builds and uploads data with read-only permissions, while trusted workflow code on the default branch performs the privileged comment operation without checking out or executing contributor code.
The trusted workflow resolves the PR from the run's fork owner, branch, and exact head SHA because GitHub does not populate
workflow_run.pull_requestsfor these fork runs.Validation
git diff --checkactionlint .github/workflows/pr-validation.yml .github/workflows/pr-api-diff-comment.ymlgithub-scriptJavaScript syntax check with Node.jswinmdartifact and confirmed it contains the expected zero-lengthapi-diff.patchfor the no-diff result.danfiedler-msft:danfiedler/pin-actionsand its exact workflow head SHA.The
workflow_runjob itself can only execute after this workflow definition exists on the default branch, which is the GitHub security boundary that gives the trusted follow-up workflow write permission.