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
Section titled “The file”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.
Top-level keys
Section titled “Top-level keys”| 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.
executors
Section titled “executors”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 |
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.
commands
Section titled “commands”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 |
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-errorortimeout-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.
executor
Section titled “executor”The name of an executor from executors:. A job takes executor or
runs-on, never both.
executors: big: runs-on: ubuntu-26.04-8corejobs: build: executor: big steps: - run: makeruns-on
Section titled “runs-on”A runner template label. A label that names no template is an error that lists the valid labels.
jobs: build: runs-on: ubuntu-26.04-arm steps: - run: makeparallelism
Section titled “parallelism”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.
jobs: test: runs-on: ubuntu-latest parallelism: 4 steps: - run: make testEnvironment variables set for every step. Numbers and booleans are read as strings. Values can hold expressions.
jobs: test: runs-on: ubuntu-latest env: CI: true RUST_BACKTRACE: 1 SHA: ${{ github.sha }} steps: - run: cargo testAn 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.
jobs: docs: runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - run: make docsenvironment
Section titled “environment”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.
jobs: deploy: runs-on: ubuntu-latest environment: production steps: - run: ./deploy.shA 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.
timeout-minutes
Section titled “timeout-minutes”Minutes the job may run before it is cancelled. Default 360.
jobs: test: runs-on: ubuntu-latest timeout-minutes: 20 steps: - run: make testoutputs
Section titled “outputs”Named values a later job reads as ${{ needs.JOB.outputs.NAME }}.
Usually set from a step’s output.
jobs: version: runs-on: ubuntu-latest outputs: tag: ${{ steps.v.outputs.tag }} steps: - id: v run: echo "tag=v1.2.3" >> "$GITHUB_OUTPUT"Parameter names a job cannot use
Section titled “Parameter names a job cannot use”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.
run step
Section titled “run step”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 |
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: falseuses step
Section titled “uses step”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 |
jobs: build: runs-on: ubuntu-latest steps: - name: Install Go id: go uses: actions/setup-go@v5 with: go-version: '1.25'withis valid only on ausesstep.shell,working-directoryandtimeout-minutesare valid only on arunstep.- A step with both
runandusesis an error. uses: docker://...is an error until Docker support ships.
command step
Section titled “command step”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 } |
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 |
jobs: test: runs-on: ubuntu-latest steps: - cache: key: npm-${{ hashFiles('package-lock.json') }} restore-keys: [npm-] paths: [~/.npm]workspace
Section titled “workspace”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 |
jobs: build: runs-on: ubuntu-latest steps: - run: make dist - workspace: persist: root: . paths: [dist] ship: runs-on: ubuntu-latest steps: - workspace: attach: at: .test-results
Section titled “test-results”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 |
jobs: test: runs-on: ubuntu-latest steps: - run: pytest --junitxml=reports/junit.xml - test-results: reportscache, workspace and test-results take no other keys: no
name, if or env.
parameters
Section titled “parameters”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 |
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
defaultis required. - A value that holds a
${{ }}expression passes any type check. enumvalues needtype: enum, andtype: enumneedsenum.
Reading parameters
Section titled “Reading parameters”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.
workflows
Section titled “workflows”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 |
jobs: test: runs-on: ubuntu-latest steps: - run: make testworkflows: ci: on: push: branches: [main] pull_request: {} jobs: - teston: {} is valid and never starts the workflow.
Workflow job entries
Section titled “Workflow job entries”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.
requires
Section titled “requires”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.
jobs: test: runs-on: ubuntu-latest steps: - run: make test build: runs-on: ubuntu-latest steps: - run: make buildworkflows: ci: on: push: {} jobs: - test - build: requires: [test]type: approval
Section titled “type: approval”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.
jobs: deploy: runs-on: ubuntu-latest steps: - run: ./deploy.shworkflows: release: on: push: branches: [main] jobs: - hold: type: approval - deploy: requires: [hold]branches and tags
Section titled “branches and tags”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.
jobs: publish: runs-on: ubuntu-latest steps: - run: ./publish.shworkflows: ci: on: push: {} jobs: - publish: tags: ['v*']matrix
Section titled “matrix”Keys mapped to lists of values. The entry runs one job per combination. See Build a matrix.
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.
Parameter values
Section titled “Parameter values”Any other key on an entry sets the job parameter of that name:
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: integrationA value cannot read ${{ parameters... }}; a workflow has no
parameters.
Job ids after expansion
Section titled “Job ids after expansion”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.