What is the difference between `GITHUB_TOKEN`, a fine-grained PAT, and a GitHub App token in workflows?
IntermediateConceptSecrets, Variables, Environments & Permissions
Answer
GITHUB_TOKEN: automatic, per job, single repo, expires at job end, cannot trigger workflows. Default choice.- Fine-grained PAT: tied to a person, multi-repo, long-lived; breaks when the person leaves, and actions appear as them. Avoid.
- GitHub App token: minted at runtime with
actions/create-github-app-token, scoped to selected repos and permissions, valid one hour, acts as the app, does trigger workflows. Use for cross-repo access and release automation.
- id: app
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_KEY }}
repositories: shack-api,shack-helm
More on Secrets, Variables, Environments & Permissions
Where can secrets be defined, and what is the precedence?BeginnerHow are secrets protected in transit and in logs, and what are the limits?IntermediateAre secrets available to every step automatically?BeginnerWhy is it a bad idea to store structured data like JSON or a whole `.env` file as one secret?IntermediateWhat is an environment, and which protection rules can it have?BeginnerWhen does a job wait for environment approval, and what does the reviewer see?Intermediate