What is the `GITHUB_TOKEN` and how should you scope it?
IntermediateConceptGitHub Actions
Answer
GITHUB_TOKEN is an automatically created, short-lived token for each job, scoped to the repository. Its default permissions depend on repo/org settings, so set the default to read-only and grant per workflow or job with permissions:. Anything not listed becomes none once you declare permissions.
permissions:
contents: read
jobs:
release:
permissions:
contents: write
packages: write
id-token: write
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate