Code Reference

Runners

GitHub Actions · Reference cheat sheet

Runners

GitHub Actions · Reference cheat sheet


📋 Overview

Runners execute jobs. GitHub-hosted runners (ubuntu-latest, windows-latest, macos-latest) are ephemeral VMs. Self-hosted runners persist on your hardware—isolate them carefully. Labels select where a job lands.

🔧 Core concepts

LabelNotes
ubuntu-latestDefault Linux; version floats
ubuntu-24.04 / 22.04Pin OS image
windows-latestPowerShell default shell
macos-latestScarcer / costlier
[self-hosted, linux, x64]Custom labels
TopicDetail
Tool cachePreinstalled SDKs on hosted images
SpecsCPU/RAM vary by label (larger runners available)
NetworkingOutbound internet; inbound limited
EphemeralHosted disk resets each job

Image software lists live in actions/runner-images.

💡 Examples

Hosted job:

jobs:
  test:
    runs-on: ubuntu-24.04
    steps:
      - run: lsb_release -a
      - run: node -v || true

Self-hosted:

jobs:
  build:
    runs-on: [self-hosted, linux, gpu]
    steps:
      - uses: actions/checkout@v4
      - run: ./build.sh

Larger runners (org feature):

runs-on: ubuntu-latest-4-cores

⚠️ Pitfalls

  • *-latest moves—pin versions for reproducibility when it matters.
  • Self-hosted runners can retain secrets/workspace—use ephemeral runners or strict cleanup.
  • Never attach self-hosted runners to public repos without hardening (fork PR risk).
  • macOS minutes cost more—use only when required.
  • Custom container jobs (container:) change the environment vs bare VM.
  • Software may be missing—use setup actions instead of assuming host tools.

On this page