workflow permissions
The workflow or job key that sets exactly what the GITHUB_TOKEN may do, such as contents: read.
In more detail
Writing the block replaces all defaults, so list everything the job needs. A common pattern keeps the whole workflow read-only and grants write access only to the one job that needs it.
Example
permissions:
contents: readRelated terms
- GITHUB_TOKEN — A short-lived access token GitHub creates for each job so the workflow can call the GitHub API for its own repository.
- least privilege — Giving every program and person only the access they need, and nothing more.
- id-token: write — The workflow permission that allows a job to request a GitHub OpenID Connect token.
Taught in
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- Keyless Authentication: OIDC to the Cloud — Continuous Integration & Continuous Delivery Pipelines
- Building and Pushing Container Images — Continuous Integration & Continuous Delivery Pipelines
- The Workflow That Ran On A Stranger's Pull Request — GitHub Actions (GH-200) Exam Prep
- Reusable Workflows: Inputs, Secrets And Outputs Across A Call — GitHub Actions (GH-200) Exam Prep
- GITHUB_TOKEN: Least Privilege, Job By Job — GitHub Actions (GH-200) Exam Prep
- Environments: Reviewers, Wait Timers And Deployment Rules — GitHub Actions (GH-200) Exam Prep
- OIDC: Cloud Access Without Stored Keys — GitHub Actions (GH-200) Exam Prep
- Supply Chain: Pinning, Trusted Actions And Attestations — GitHub Actions (GH-200) Exam Prep
- YAML-Reading Sprint: What Happens When This Runs? — GitHub Actions (GH-200) Exam Prep