Skip to content

Restore pull-requests: write so release-note comments can post - #20136

Closed
T-Gro wants to merge 1 commit into
mainfrom
fix/release-notes-comment-nonfatal
Closed

Restore pull-requests: write so release-note comments can post#20136
T-Gro wants to merge 1 commit into
mainfrom
fix/release-notes-comment-nonfatal

Conversation

@T-Gro

@T-Gro T-Gro commented Aug 4, 2026

Copy link
Copy Markdown
Member

check_release_notes (rewritten in #20081) reduced the token to
pull-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 comment
from before #20081 kept passing, 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. 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_notes stays red: pull_request_target loads the
workflow from the base branch, so this PR runs the old main workflow and can't
validate its own replacement — the same expected exception noted in #20081.

@T-Gro
T-Gro requested a review from a team as a code owner August 4, 2026 09:03
@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Aug 4, 2026
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
T-Gro force-pushed the fix/release-notes-comment-nonfatal branch from d37e02c to 13db6a3 Compare August 4, 2026 10:31
@T-Gro T-Gro changed the title Make release-notes status comment non-fatal Restore pull-requests: write so release-note comments can post Aug 4, 2026
@T-Gro T-Gro closed this Aug 4, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant