Skip to content

Reference / Configuration reference

Configuration reference

hatchrun CI reads .hatchrun/config.yml at the commit of each event. This page lists every key. Each section has a table and an example that passes hatchrun validate.

The file is YAML 1.2. Only true and false are booleans; yes, no, on and off are strings. The file can be at most 1 MiB.

Unknown keys are errors everywhere except two places that take free names: command steps and workflow job entries.

hatchrun validate stops at the first problem in the YAML or the file’s shape. Once the shape is right, it reports every other problem it finds.

Key Required Type Default Description
executors no map none Named runner templates that jobs share
commands no map none Named, reusable lists of steps
jobs no map none Jobs, each a list of steps on one machine
workflows no map none Triggers and the jobs they run

An empty file is valid and runs nothing.


A map of executor names to executors. A job names one with executor.

Key Required Type Default Description
runs-on yes string A runner template label
.hatchrun/config.yml
executors:
small:
runs-on: ubuntu-latest
big-arm:
runs-on: ubuntu-26.04-8core-arm
  • A label that names no template is an error, even if no job uses the executor.
  • docker: is reserved for a later release and is an error today.

A map of command names to commands. A job or another command calls a command as a step.

Key Required Type Default Description
parameters no map of parameters none Inputs the steps read as ${{ parameters.NAME }}
steps no list of steps [] The steps
.hatchrun/config.yml
commands:
setup:
parameters:
node:
type: integer
default: 22
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: ${{ parameters.node }}
- run: npm ci
  • A command cannot have the name of a step key: name, id, env, if, with, shell, run, uses, cache, workspace, test-results, working-directory, continue-on-error or timeout-minutes.
  • Commands can call commands up to 64 levels deep. A command that reaches itself is an error.

A map of job names to jobs. A job runs its steps in order on one fresh machine. It runs only when a workflow lists it.

Key Required Type Default Description
executor one of executor, runs-on string An executor from executors:
runs-on one of executor, runs-on string A runner template label
parameters no map none Inputs the job’s steps and fields read
parallelism no integer 1 Copies of the job to run, 1 to 64
environment no string or map none The deploy environment the job uses
env no map of strings none Environment variables for every step
if no expression none The job runs only when this is true
timeout-minutes no integer 360 Minutes before the job is cancelled
outputs no map of strings none Values later jobs read through needs
steps no list [] The steps

services: and container: are reserved for a later release and are errors today.

The name of an executor from executors:. A job takes executor or runs-on, never both.

.hatchrun/config.yml
executors:
big:
runs-on: ubuntu-26.04-8core
jobs:
build:
executor: big
steps:
- run: make

A runner template label. A label that names no template is an error that lists the valid labels.

.hatchrun/config.yml
jobs:
build:
runs-on: ubuntu-26.04-arm
steps:
- run: make

How many copies of the job run at once. Copies are separate jobs with ids ending in [1/N] to [N/N]. See Split tests across parallel jobs.

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
parallelism: 4
steps:
- run: make test

Environment variables set for every step. Numbers and booleans are read as strings. Values can hold expressions.

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
env:
CI: true
RUST_BACKTRACE: 1
SHA: ${{ github.sha }}
steps:
- run: cargo test

An expression. The job runs only when it is true. Write it bare or inside ${{ }}.

Without a status function, the job also needs every job it requires to have succeeded.

.hatchrun/config.yml
jobs:
docs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- run: make docs

The environment the job deploys to, either a name or a map with name. The job gets the environment’s secrets and variables, and runs only on the branches it allows. If the environment requires approval, the job waits for an organization admin.

.hatchrun/config.yml
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- run: ./deploy.sh

A name is 1 to 255 letters, digits, -, _ or .. The name can read ${{ parameters.NAME }} and no other expression. A map can hold only name. The environment must exist in the repository when the job starts.

Minutes the job may run before it is cancelled. Default 360.

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- run: make test

Named values a later job reads as ${{ needs.JOB.outputs.NAME }}. Usually set from a step’s output.

.hatchrun/config.yml
jobs:
version:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.v.outputs.tag }}
steps:
- id: v
run: echo "tag=v1.2.3" >> "$GITHUB_OUTPUT"

A job parameter cannot be called name, requires, type, branches, tags or matrix. A workflow entry reads those keys as its own, so it could never set the parameter.


A list of steps. A step is one of six kinds, told apart by its keys:

Kind Identified by
run a run key
uses a uses key
command a bare string, or a map whose one key is not a step key
cache a cache key
workspace a workspace key
test-results a test-results key

A step map with none of these keys is an error.

Runs a shell script.

Key Required Type Default Description
run yes string The script
name no string Shown in logs
id no string Lets later steps read this step’s outputs as steps.ID.outputs.NAME
shell no string The shell that runs the script
working-directory no string The directory the script runs in
env no map of strings Environment variables for this step
if no expression The step runs only when this is true
continue-on-error no boolean false A failure does not fail the job
timeout-minutes no integer Minutes before the step is cancelled
.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Unit tests
id: unit
run: |
npm ci
npm test
shell: bash
working-directory: web
env:
NODE_ENV: test
timeout-minutes: 15
continue-on-error: false

Runs a GitHub action, fetched from GitHub at the named ref. See Use GitHub actions in steps.

Key Required Type Default Description
uses yes string owner/repo@ref, owner/repo/path@ref or ./path
with no map The action’s inputs
name no string Shown in logs
id no string Lets later steps read this step’s outputs
env no map of strings Environment variables for this step
if no expression The step runs only when this is true
continue-on-error no boolean false A failure does not fail the job
.hatchrun/config.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Go
id: go
uses: actions/setup-go@v5
with:
go-version: '1.25'
  • with is valid only on a uses step.
  • shell, working-directory and timeout-minutes are valid only on a run step.
  • A step with both run and uses is an error.
  • uses: docker://... is an error until Docker support ships.

Calls a command from commands:. Write the bare name, or a map with one key, the name, whose value sets the command’s parameters.

Form Example
Bare name, defaults only - setup
Map with parameter values - setup: { node: 20 }
.hatchrun/config.yml
commands:
greet:
parameters:
who: { type: string, default: world }
steps:
- run: echo "hello ${{ parameters.who }}"
jobs:
hello:
runs-on: ubuntu-latest
steps:
- greet
- greet: { who: hatchrun }

A command step takes no other keys. A misspelled step key, such as rnu:, reads as a call to a command that does not exist.

Restores a saved copy of paths when the step runs, and saves them when the job ends. See Cache dependencies.

Key Required Type Default Description
key yes string The exact key to restore and save under
restore-keys no list of strings [] Key prefixes to fall back to, in order
paths no list of strings [] The paths cached
.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- cache:
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: [npm-]
paths: [~/.npm]

Passes files to later jobs in the same workflow run. It takes one of two forms. See Share files between jobs.

Key Required Type Default Description
persist.root yes, with persist string The directory paths are relative to
persist.paths no list of strings [] The paths saved
attach.at yes, with attach string The directory to restore into
.hatchrun/config.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: make dist
- workspace:
persist:
root: .
paths: [dist]
ship:
runs-on: ubuntu-latest
steps:
- workspace:
attach:
at: .

Uploads JUnit XML results. The value is a file or a directory. See Collect test results.

Key Required Type Default Description
test-results yes string Path to a JUnit XML file or a directory of them
.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: pytest --junitxml=reports/junit.xml
- test-results: reports

cache, workspace and test-results take no other keys: no name, if or env.


Commands, jobs and on.workflow_dispatch.inputs declare parameters with the same keys.

Key Required Type Default Description
type yes string, boolean, integer or enum The value type
enum with type: enum list of strings The allowed values
default no any none The value used when none is given
description no string none Shown to people filling it in
.hatchrun/config.yml
jobs:
deploy:
runs-on: ubuntu-latest
parameters:
target:
type: enum
enum: [staging, production]
default: staging
description: Where to deploy
dry-run:
type: boolean
default: true
replicas:
type: integer
default: 2
tag:
type: string
steps:
- run: ./deploy.sh ${{ parameters.target }} ${{ parameters.tag }} ${{ parameters.replicas }} ${{ parameters.dry-run }}
type Accepts
string A string, number or boolean
boolean true or false
integer A whole number
enum One of the strings in enum
  • A parameter without a default is required.
  • A value that holds a ${{ }} expression passes any type check.
  • enum values need type: enum, and type: enum needs enum.

Steps and job fields read a parameter as ${{ parameters.NAME }}. hatchrun replaces it when it plans the run. No parameters context exists when steps run.

  • Only a whole ${{ parameters.NAME }} is replaced. An expression that does more, such as ${{ parameters.env == 'prod' }}, is an error.
  • A string that is exactly one ${{ parameters.NAME }} takes the value with its type. Inside longer text, the value becomes text.
  • Reading a parameter the job or command does not declare is an error.
  • A replaced string may be at most 64 KiB.

A map of workflow names to workflows.

Key Required Type Default Description
on yes map The events that start the workflow. See Triggers
jobs yes list Workflow job entries
.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: make test
workflows:
ci:
on:
push:
branches: [main]
pull_request: {}
jobs:
- test

on: {} is valid and never starts the workflow.

Each entry is a job name, or a map with one key, the job name, whose value holds these keys:

Key Required Type Default Description
name no string the job name The entry’s id; needed when a job appears twice
requires no list of ids [] Entries that must finish first
type no approval The entry waits for a person and runs no job
branches no filter Branches the entry runs on
tags no filter Tags the entry runs on
matrix no map of lists One job per combination of values
any other key no any A value for the job’s parameter of that name

Entry ids must be unique in a workflow.

Ids of entries that must finish before this one starts. An entry that requires a matrix or parallel entry waits for all of its jobs. A loop is an error.

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: make test
build:
runs-on: ubuntu-latest
steps:
- run: make build
workflows:
ci:
on:
push: {}
jobs:
- test
- build:
requires: [test]

An entry with type: approval runs no job. Its key is its id and names no job. It waits for a person to approve it. It takes requires, branches and tags only.

.hatchrun/config.yml
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- run: ./deploy.sh
workflows:
release:
on:
push:
branches: [main]
jobs:
- hold:
type: approval
- deploy:
requires: [hold]

Filters on the ref of the event. For a pull request the ref is the base branch; for a schedule, the default branch.

Entry has On a branch On a tag
neither runs runs
only branches runs when it matches dropped
only tags dropped runs when it matches
both runs when branches matches runs when tags matches

A dropped entry takes every entry that requires it with it.

.hatchrun/config.yml
jobs:
publish:
runs-on: ubuntu-latest
steps:
- run: ./publish.sh
workflows:
ci:
on:
push: {}
jobs:
- publish:
tags: ['v*']

Keys mapped to lists of values. The entry runs one job per combination. See Build a matrix.

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo ${{ matrix.os-image }} ${{ matrix.node }}
workflows:
ci:
on:
push: {}
jobs:
- test:
matrix:
node: [20, 22]
os-image: [slim, full]
  • Steps read values as ${{ matrix.KEY }}.
  • A key the job declares as a parameter also sets that parameter.
  • Every key needs a value, values must be unique per key, and a key cannot also be a parameter value on the entry.
  • At most 256 combinations.

Any other key on an entry sets the job parameter of that name:

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
parameters:
suite: { type: string, default: unit }
steps:
- run: make test-${{ parameters.suite }}
workflows:
ci:
on:
push: {}
jobs:
- test
- test:
name: integration
suite: integration

A value cannot read ${{ parameters... }}; a workflow has no parameters.

Each matrix combination and parallel copy is its own job with its own id and check run:

Entry Planned job ids
test test
test, matrix node: [20, 22] test (20), test (22)
test, matrix node: [20, 22], os: [a, b] test (20, a), test (20, b), test (22, a), test (22, b)
test on a job with parallelism: 2 test [1/2], test [2/2]
both test (20) [1/2], test (20) [2/2], …

Matrix values appear in the order of their keys sorted by name, and the first key changes slowest.