ci: pii-scan needs explicit pull-requests:read for private consumers#123
Merged
Conversation
gitleaks-action@v2 lists PR commits to determine scan scope. In private-repo consumers of this reusable workflow, the default GITHUB_TOKEN withholds pull-requests:read, returning 403 "Resource not accessible by integration" before the scan can run. Public claude-code-bot has been fine under the more permissive default for public repos; downstream private consumers (e.g. the workspace at fitz123/Minime) get the failure. Explicit permissions block fixes it across both consumer classes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an explicit permissions: block to .github/workflows/pii-scan.yml so that the reusable gitleaks workflow has pull-requests: read when consumed by private repos, fixing a 403 from gitleaks-action@v2.
Changes:
- Add top-level
permissions:grantingcontents: readandpull-requests: read. - Add explanatory comment documenting the rationale.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
6 tasks
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
permissions:block topii-scan.ymlgrantingcontents: readandpull-requests: read.Resource not accessible by integration(403) on private-repo consumers of the reusable gitleaks workflow.Why
gitleaks-action@v2callsGET /repos/{owner}/{repo}/pulls/{number}/commitsto determine scan scope on PR events. The defaultGITHUB_TOKENfor private repos withholdspull-requests: read, so the call returns 403 and the action exits before scanning. Public repos (including this one) have been getting it under the more permissive default for public projects — but the moment a downstream private repo consumed the workflow viaworkflow_callit broke.Repro: fitz123/Minime#35 — pii-scan run https://github.com/fitz123/Minime/actions/runs/25995425868 fails with the exact 403 message.
Test plan