Restore pull-requests: write so release-note comments can post - #20136
Closed
T-Gro wants to merge 1 commit into
Closed
Restore pull-requests: write so release-note comments can post#20136T-Gro wants to merge 1 commit into
T-Gro wants to merge 1 commit into
Conversation
T-Gro
pushed a commit
that referenced
this pull request
Aug 4, 2026
The release-notes comment failure is a non-required check that fails for every PR modifying files under .github/workflows/: pull_request_target grants a read-only GITHUB_TOKEN in that case, so the comment write returns 403. This cannot be fixed from a PR branch because pull_request_target runs the base-branch (main) workflow, and it is already addressed by the dedicated PR #20136. Keep this PR focused on the labelops threat-detection fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The check_release_notes workflow (rewritten in #20081) reduced the token to pull-requests: read. issues.createComment (POST) on a pull request requires pull-requests: write, so brand-new PRs that have no existing bot comment -- for example dependency updates opened by dotnet-maestro (#20134) -- failed with 403 'Resource not accessible by integration'. Only PRs that already had a comment from before #20081 passed, because the updateComment (PATCH) path works with issues: write. The security fix in #20081 was removing the untrusted fork-head checkout; that protection is unchanged. No untrusted code runs and the comment body is passed via an environment variable, so restoring pull-requests: write does not reintroduce the fork-checkout risk. Also wrap the comment logic in try/catch so posting the informational comment can never fail the release-notes gate, which is enforced by the previous step's exit code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
T-Gro
force-pushed
the
fix/release-notes-comment-nonfatal
branch
from
August 4, 2026 10:31
d37e02c to
13db6a3
Compare
T-Gro
pushed a commit
that referenced
this pull request
Aug 4, 2026
…t 403 Rewriting the release-notes check in #20081 reduced the token to pull-requests: read, but posting a NEW PR comment (issues.createComment POST) requires pull-requests: write. Brand-new PRs with no existing bot comment (like #20130 and dependency PRs) therefore fail with 403 'Resource not accessible by integration', while PRs with a pre-existing comment pass via the updateComment PATCH path (allowed by issues: write). Restore pull-requests: write (the fork-head checkout removed in #20081 stays removed, so no untrusted code runs and the comment body is passed via env var) and wrap the comment write in try/catch so the best-effort informational comment can never fail the release-notes gate. Supersedes the abandoned PR #20136. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
check_release_notes(rewritten in #20081) reduced the token topull-requests: read. Creating a PR comment (issues.createComment, a POST)requires
pull-requests: write, so brand-new PRs with no existing bot comment —such as the dependency updates dotnet-maestro opens (#20134) — failed with 403
Resource not accessible by integration. Only PRs that already had a commentfrom before #20081 kept passing, because the
updateComment(PATCH) path workswith
issues: write.The security fix in #20081 was removing the untrusted fork-head checkout; that
protection is unchanged. No untrusted code runs and the comment body is passed
via an environment variable, so restoring
pull-requests: writedoes notreintroduce the fork-checkout risk. The comment step is also wrapped in
try/catch so posting the informational comment can never fail the release-notes
gate.
This PR's own
check_release_notesstays red:pull_request_targetloads theworkflow from the base branch, so this PR runs the old
mainworkflow and can'tvalidate its own replacement — the same expected exception noted in #20081.