What happens to a GitHub Actions workflow's permissions when it accesses a repository from a fork PR?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Fork PR security is a key GitHub Actions concept. When someone forks your repo and opens a PR, the workflow runs from their fork code — so GitHub restricts it: read-only token, no secrets. You'd be running untrusted code with full access otherwise. This is the right default.
Full explanation below image
Full Explanation
When a pull request originates from a fork (not a branch in the same repository), GitHub Actions applies additional security restrictions: (1) The GITHUB_TOKEN has read-only permissions — it cannot write to the repository, create releases, or post comments. (2) Secrets are not passed to the workflow — environment variables from secrets are empty. (3) This prevents a malicious contributor from opening a fork PR to exfiltrate your secrets or modify your repository. To post comments or take actions on fork PRs, maintainers can use: (a) the 'pull_request_target' event (runs in base repo context, has secrets — use carefully). (b) A manually triggered workflow after reviewing the fork's code. For Dependabot PRs, GitHub automatically provides limited secrets through the 'pull_request' event when the PR is auto-created.