GitHub Actions Cheat Sheet
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
A compact reference for GitHub Actions as of 2026-11-10, with actions/checkout v7, actions/setup-node v7,
actions/cache v6 and actions/upload-artifact v7. For explanations and complete examples, follow the page links at the end.
Workflow skeleton
name: ci
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- run: npm ci && npm test
Triggers
| Trigger | Notes |
|---|---|
|
Filter with |
|
Cron in UTC, default branch only. |
|
Manual run with typed |
|
Makes the workflow reusable. |
|
Chain on releases or on other workflows. |
|
Runs with secrets in the base context; never run PR code in it. |
Expressions and contexts
| Expression | Meaning |
|---|---|
|
Commit and branch or tag name. |
|
Secret and configuration variable. |
|
Output of a required job. |
|
Current matrix value. |
|
Hash of files, used in cache keys. |
|
Status functions for |
Passing data
echo "version=1.2.3" >> "$GITHUB_OUTPUT" # step output
echo "NAME=value" >> "$GITHUB_ENV" # env for later steps
echo "### Done" >> "$GITHUB_STEP_SUMMARY" # run summary
echo "::add-mask::$TOKEN" # mask a value
Runner labels
| Label | Image |
|---|---|
|
Linux x64 and arm64. |
|
Windows. |
|
macOS arm64 and Intel. |
|
Your own runner, selected by labels. |
Matrix, services, caching
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node: [22, 24]
steps:
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node }}
cache: npm
- uses: actions/upload-artifact@v7
with:
name: site
path: build/site
retention-days: 7
Permissions, OIDC, environments
permissions:
contents: read
id-token: write # request an OIDC token
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: https://example.com
steps:
- run: ./deploy.sh
call-shared:
uses: org/repo/.github/workflows/deploy.yml@v1 # reusable workflow
secrets: inherit
Release publishing
| Target | Typical step |
|---|---|
GitHub release |
|
Maven Central |
|
npm |
|
PyPI |
|
NuGet |
|
GHCR |
|
GitHub Pages |
|
gh commands
gh workflow list
gh workflow run publish.yml -f debug=true
gh run list --workflow publish.yml
gh run watch
gh run view --log-failed
gh run rerun --failed
gh run download -n site
gh secret set NAME
gh variable set NAME --body value
actionlint
Where to go next
Building blocks — Using and Writing Actions, Caching and Artifacts and Reusable Workflows and Composite Actions.
Credentials and delivery — Secrets, Variables and OIDC, Environments and Deployment Protection, Security Hardening and Release Pipelines.
Diagnosis — Troubleshooting and Debugging.
Related — Git & GitHub and Tags and Releases.