fix(closed): grant pull-requests write to CommentSubPRs job [FTTECH-10130]#153
Open
florentsorel wants to merge 2 commits into
Open
fix(closed): grant pull-requests write to CommentSubPRs job [FTTECH-10130]#153florentsorel wants to merge 2 commits into
florentsorel wants to merge 2 commits into
Conversation
Le job « Comment rebase --onto on Sub PRs » (action after-pr-merged) tourne sans bloc permissions:. Quand le GITHUB_TOKEN par defaut est rabote au niveau org, le tout premier appel (pulls.get) renvoie 403 « Resource not accessible by integration » et le job echoue sur chaque PR mergee — CI rouge cosmetique post-merge + le memo « rebase --onto » n'est jamais poste sur les sous-PR. On accorde explicitement les scopes minimaux dont l'action a besoin : pull-requests:write (pulls.get/list + creation/maj du commentaire sur les sous-PR) et contents:read. Independant de la permission par defaut de l'org. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the canonical closed.yml workflow snippet (used by the after-pr-merged action) to explicitly grant the GITHUB_TOKEN the permissions needed by the CommentSubPRs job, preventing 403 Resource not accessible by integration failures in repos with restricted default token permissions.
Changes:
- Add an explicit
permissions:block to theCommentSubPRsjob insample/workflows/closed.yml.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+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.
Problème
Le job
Comment rebase --onto on Sub PRsdu snippetclosed.yml(actionafter-pr-merged) échoue sur chaque PR mergée, dans tous les repos qui consomment ce snippet (constaté surpanoramai: 100 % des PR mergées en rouge sur le check « Closed PR Housekeeping »).Le job n'a aucun bloc
permissions:. Quand la permission par défaut duGITHUB_TOKENest rabotée au niveau org/repo, le token n'a pas le scopepull-requests, donc le tout premier appel (pulls.get) renvoie 403 avant même d'arriver àpulls.list/issues.createComment.Impact : CI rouge cosmétique post-merge (ne bloque aucune PR) + le commentaire « 👉 rebase --onto » n'est jamais posté sur les sous-PR empilées.
Fix
On déclare explicitement les scopes minimaux dont l'action a besoin sur ce job :
pull-requests: write→pulls.get,pulls.list, et création/maj du commentaire sur les sous-PR (les sous-PR sont des PR, donc le scope pull-requests couvre l'endpoint issues/comments).contents: read.Indépendant de la permission par défaut de l'org (un bloc
permissions:explicite l'emporte sur le défaut restrictif).Distribution
sample/workflows/closed.ymlest la source canonique référencée pargithub-mobsuccess-policy(app/policies/gh-actions.js→ actionclosed). Une fois mergé, mobsuccessbot re-sync le snippet wrappé dans tous les repos.🤖 Generated with Claude Code