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

LabelOSCPURAMSSD
ubuntu-latestUbuntu 24.04416 GB14 GB
ubuntu-24.04Ubuntu 24.04416 GB14 GB
ubuntu-22.04Ubuntu 22.04416 GB14 GB
ubuntu-20.04Ubuntu 20.04416 GB14 GB
windows-latestWindows Server 2022416 GB14 GB
windows-2022Windows Server 2022416 GB14 GB
windows-2019Windows Server 2019416 GB14 GB
macos-latestmacOS 15314 GB14 GB
macos-15macOS 15 (M1)314 GB14 GB
macos-14macOS 14 (M1)314 GB14 GB
macos-13macOS 13 (Intel)414 GB14 GB

ubuntu-latest, windows-latest, and macos-latest move 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 labels

Runner Scopes

ScopeRegistered in
RepositoryRepo → Settings → Actions → Runners
OrganizationOrg → Settings → Actions → Runners
EnterpriseEnterprise → 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 && pytest

Ephemeral / 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

ResourceLimit
Workflow run timeout35 days
Job timeout6 hours (self-hosted: 5 days)
Jobs per matrix256
Concurrent jobs (free)20 (Linux), 5 (macOS)
Artifact size10 GB
Cache size10 GB per repo
Workflow file size512 KB
Step timeout6 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 }}"