GITHUB_TOKEN
A short-lived access token GitHub creates for each job so the workflow can call the GitHub API for its own repository.
An over-privileged token lets any compromised step change your repository.
In more detail
It expires when the job ends, but its default scope can be broad. The permissions key narrows it, for example contents: read for the whole workflow and contents: write only for the one job that must push. Under pull_request from a fork it is read-only.
Related terms
- workflow permissions — The workflow or job key that sets exactly what the GITHUB_TOKEN may do, such as contents: read.
- secret — Any value that grants access, such as a password, access token or private key, and must be kept out of code and version control.
- least privilege — Giving every program and person only the access they need, and nothing more.
- GitHub Actions — GitHub's built-in automation service that runs workflows, written as YAML files in a repository, on runners when events happen.
Taught in
- Service Connections, Identities And Tokens — Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep
- Triggers and the Event Model — Continuous Integration & Continuous Delivery Pipelines
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- Shift-Left Security Principles & Automated Pipeline Gates — Cloud Security & DevSecOps Engineering
- Workload Identity Federation: Eliminating Static Keys — Cloud Security & DevSecOps Engineering
- 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
- Why It Ran, Why It Did Not: Reading Runs, Jobs And Checks — GitHub Actions (GH-200) Exam Prep
- Governing Actions: Allow Lists, SHA Pinning And Rulesets — GitHub Actions (GH-200) Exam Prep
- Secrets And Variables By Scope: Precedence, Access And The REST API — GitHub Actions (GH-200) Exam Prep
- GITHUB_TOKEN: Least Privilege, Job By Job — GitHub Actions (GH-200) Exam Prep
- Full Mock And Review: Where Your Points Go — GitHub Actions (GH-200) Exam Prep