Skip to content

Commit 869e038

Browse files
committed
docs: clarify GITHUB_TOKEN permissions needed for private repos (fixes #1248)
1 parent f35c645 commit 869e038

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,38 @@ GitHub's new [Repository Rules](https://docs.github.com/repositories/configuring
8787
We recommend new repositories use Repository Rules so they can be read with the default GitHub token.
8888
Repositories that already use classic Branch Protection and wish to see their results without an admin token should consider migrating to Repository Rules.
8989

90+
### Additional permissions for private repositories
91+
92+
When running Scorecard Action on **private repositories** with the default `GITHUB_TOKEN`, you may need a few **job-level read permissions** so the action can query commits and detect configured SAST tools. Without them you can see errors like:
93+
94+
> `Resource not accessible by integration` (GraphQL ListCommits)
95+
96+
Add these to the **job** that runs `ossf/scorecard-action`:
97+
98+
```yaml
99+
jobs:
100+
analysis:
101+
runs-on: ubuntu-latest
102+
permissions:
103+
# Required when publishing results (badge / API / code scanning):
104+
security-events: write
105+
id-token: write
106+
# Recommended reads for private repos to avoid GraphQL/SAST gaps:
107+
contents: read
108+
issues: read
109+
pull-requests: read
110+
checks: read
111+
# (optional) if your workflow needs to read workflow metadata:
112+
actions: read
113+
steps:
114+
- uses: actions/checkout@v4
115+
- uses: ossf/scorecard-action@v2
116+
with:
117+
results_file: results.sarif
118+
results_format: sarif
119+
```
120+
121+
90122
## View Results
91123
92124
The workflow is preconfigured to run on every repository contribution. After making a code change, you can view the results for the change either through the Scorecard Badge, Code Scanning Alerts or GitHub Workflow Runs.

0 commit comments

Comments
 (0)