Repository navigation
Description
Code of Conduct
- I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
What part(s) of the article would you like to see updated?
Who can use this feature?
Users with write access if advanced setup is already enabled
To mention that pull_requests magically have security-events: write or something functionally equivalent to it.
Additional information
Confirming the cause of the error
If you're using Dependabot in your code scanning workflow, investigate the scope it's using.Uploading code scanning results for a branch usually requires the
security-events: writescope. However, code scanning always allows the uploading of results when thepull_requestevent triggers the action run. This is why, for Dependabot branches, we recommend you use thepull_requestevent instead of thepushevent.
Hallucinations follow:
-
The Actions workflow syntax
explains why fork PR tokens are read-only.Using the permissions key for forked repositories
You can use thepermissionskey to add and removereadpermissions for forked repositories, but typically you can't grantwriteaccess. The exception to this behavior is where an admin user has selected the Send write tokens to workflows from pull requests option in the GitHub Actions settings. For more information, see Managing GitHub Actions settings for a repository.-- this strongly hints that it's the only exception.
-
The code-scanning workflow guide
describes scanning onpull_requestwithout discussing the upload permission exception.Scanning pull requests
The default CodeQL analysis workflow uses thepull_requestevent to trigger a code scan on pull requests targeted against the default branch. If a pull request is from a private fork, thepull_requestevent will only be triggered if you've selected the "Run workflows from fork pull requests" option in the repository settings. For more information, see Managing GitHub Actions settings for a repository.-- doesn't mention
permissions:at all -
The SARIF upload guide
labelssecurity-events: writeas “required for all workflows” in examples that run onpushandschedule.Who can use this feature?
Users with write accessCode scanning is available for the following repository types:
- Public repositories on GitHub.com
- Organization-owned repositories on GitHub Team, GitHub Enterprise Cloud, or GitHub Enterprise Server, with GitHub Code Security enabled.
-- doesn't mention
pull_requestat all- Create more.md check-spelling-outlook/curly-giggle-ideal-garbanzo#12
(https://github.com/check-spelling-outlook/curly-giggle-ideal-garbanzo/actions/runs/46330116831/job/141558162788)
is about what GitHub accepts from a job token:
A workflow triggered bypull_requestcan upload code-scanning results for that pull request usingGITHUB_TOKENeven when the token lackssecurity-events: write, including for pull requests from forks (by users who do not have an affiliation with the PR target repo).
Activity
[-]Workflow configuration options for code scanning should mention that `pull_request` magically gets something like `security-events: write`[/-][+]Document that `pull_request` can upload SARIF without `security-events: write`[/+]github-actions commentedon Nov 30, 2026
Thanks for your submission, @jsoref! We've marked this for review by the appropriate team.