GitHub Actions Cheatsheet
Runners
Use this GitHub Actions reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.
GitHub-Hosted Runner Labels
| Label | OS | CPU | RAM | SSD |
|---|---|---|---|---|
ubuntu-latest | Ubuntu 24.04 | 4 | 16 GB | 14 GB |
ubuntu-24.04 | Ubuntu 24.04 | 4 | 16 GB | 14 GB |
ubuntu-22.04 | Ubuntu 22.04 | 4 | 16 GB | 14 GB |
ubuntu-20.04 | Ubuntu 20.04 | 4 | 16 GB | 14 GB |
windows-latest | Windows Server 2022 | 4 | 16 GB | 14 GB |
windows-2022 | Windows Server 2022 | 4 | 16 GB | 14 GB |
windows-2019 | Windows Server 2019 | 4 | 16 GB | 14 GB |
macos-latest | macOS 15 | 3 | 14 GB | 14 GB |
macos-15 | macOS 15 (M1) | 3 | 14 GB | 14 GB |
macos-14 | macOS 14 (M1) | 3 | 14 GB | 14 GB |
macos-13 | macOS 13 (Intel) | 4 | 14 GB | 14 GB |
ubuntu-latest,windows-latest, andmacos-latestmove to newer versions when new images are promoted — pin to a specific version for reproducibility.
Larger Runners (GitHub-Hosted)
Available on Team/Enterprise plans. Specify by label:
runs-on: ubuntu-latest-4-cores # 4 CPU, 16 GB runs-on: ubuntu-latest-8-cores # 8 CPU, 32 GB runs-on: ubuntu-latest-16-cores # 16 CPU, 64 GB runs-on: ubuntu-latest-32-cores # 32 CPU, 128 GB runs-on: ubuntu-latest-64-cores # 64 CPU, 256 GB
GPU runners (for ML workloads):
runs-on: ubuntu-latest-gpu-t4
Selecting a Runner
# Single label runs-on: ubuntu-latest # Multiple labels — runner must match ALL (for self-hosted) runs-on: [self-hosted, linux, x64, production] # Expression-based (dynamic selection) runs-on: ${{ matrix.os }}
Self-Hosted Runners
Register a Runner
# Download and configure mkdir actions-runner && cd actions-runner curl -o actions-runner-linux-x64-2.x.x.tar.gz -L \ https://github.com/actions/runner/releases/download/v2.x.x/actions-runner-linux-x64-2.x.x.tar.gz tar xzf ./actions-runner-linux-x64-2.x.x.tar.gz # Configure (get token from repo Settings → Actions → Runners → New) ./config.sh --url https://github.com/OWNER/REPO --token <TOKEN> # Run as a service sudo ./svc.sh install sudo ./svc.sh start
Use in a Workflow
jobs:
build:
runs-on: self-hosted # uses any available self-hosted runner
deploy:
runs-on: [self-hosted, linux, x64, gpu] # must match all labelsRunner Scopes
| Scope | Registered in |
|---|---|
| Repository | Repo → Settings → Actions → Runners |
| Organization | Org → Settings → Actions → Runners |
| Enterprise | Enterprise → Settings → Actions → Runners |
Runner Groups
Organize self-hosted runners into groups and control which repos can use them:
# Create group via API gh api orgs/ORG/actions/runner-groups \ -f name='production' \ -f visibility='selected'
Reference a group:
runs-on: group: production labels: [linux, x64]
Docker Container as Runner Environment
jobs:
test:
runs-on: ubuntu-latest
container:
image: python:3.12-slim
options: --user root
steps:
- uses: actions/checkout@v4
- run: pip install -r requirements.txt && pytestEphemeral / Just-in-Time Runners
For security-sensitive workloads, use JIT runners that register for a single job then deactivate:
# Generate JIT config (API) gh api repos/OWNER/REPO/actions/runners/generate-jitconfig \ -f name='ephemeral-1' \ -f runner_group_id=1 \ -F labels[]='self-hosted' \ -F labels[]='linux'
Runner Capabilities Pre-installed
GitHub-hosted Ubuntu runners include:
Docker, Node.js, Python, Go, Java, .NET, Ruby, PHP,
git, curl, wget, jq, gh (GitHub CLI), AWS CLI, Azure CLI,
Google Cloud SDK, Terraform, kubectl, helm, ...Full software manifests: github.com/actions/runner-images
Limits
| Resource | Limit |
|---|---|
| Workflow run timeout | 35 days |
| Job timeout | 6 hours (self-hosted: 5 days) |
| Jobs per matrix | 256 |
| Concurrent jobs (free) | 20 (Linux), 5 (macOS) |
| Artifact size | 10 GB |
| Cache size | 10 GB per repo |
| Workflow file size | 512 KB |
| Step timeout | 6 hours |
Identifying the Runner at Runtime
- run: |
echo "OS: ${{ runner.os }}"
echo "Arch: ${{ runner.arch }}"
echo "Temp: ${{ runner.temp }}"
echo "Tool cache: ${{ runner.tool_cache }}"