Skip to content
refs
6.4 KBRaw

CI configuration

This document is the reference for .refs/ci.yml, the pipeline file of a repository. For a guide, see Run CI.

File rules

  • Path: .refs/ci.yml at the root of the repository.
  • Format: YAML. Each key must be one of the keys in this document. refs reports an unknown key as a problem.
  • Size: 64 KB or less.
  • Top-level keys: on and jobs. Only jobs is required.

When the file has problems, refs reports each one with the path of the key, for example jobs.test.steps[0].run.

on

The events that start a run. If you leave out on, refs uses all three triggers on all branches.

Key Value Effect
push Empty, or branches Starts a run on a push to a matching branch.
pull_request Empty, or branches Starts a run for a pull request.
manual Empty or true Shows Start run on the Runs tab.

branches is a string or a list of branch patterns. An empty list matches each branch. In a pattern, * matches inside one path segment, and ** matches across segments. For example, release/* matches release/1.2 but not release/1.2/fix.

on:
  push:
    branches: [main, "release/**"]
  pull_request:
  manual:

jobs

A mapping from a job name to a job. A pipeline has from 1 to 64 jobs. A job name uses letters, digits, - and _, and has 64 characters or fewer.

Key Required Default Value
steps Yes None A list of 1 to 100 steps. An agent job has no steps.
image No base A built-in image. See Images.
size No standard-2 An instance size. See Sizes.
needs No None A job name or a list of job names that must succeed first.
timeout_minutes No 60 A whole number from 1 to 360.
environment No None The name of an environment in the CI settings.
secrets No None A secret name or a list of secret names.
cache No None A mapping with key and paths. refs reads this key but does not use it yet.
artifacts No None A path or a list of paths. refs reads this key but does not use it yet.

needs must not make a cycle, and each name must be a job in the file.

Agent jobs

An agent job runs a hosted agent on the pull request of the run, in place of shell steps. It needs no container, so it does not wait for a free one.

Key Required Default Value
agent Yes None The handle of a hosted agent of the repository, for example reviewer.
prompt No None What the job asks the agent, up to 4,000 characters. The agent also follows its own instructions.
needs No None A job name or a list of job names that must succeed first.
timeout_minutes No 20 A whole number from 1 to 360.

An agent job takes no other key. refs reports image, steps or secrets on an agent job as a problem.

  • The agent answers with one comment on the pull request. The job succeeds when the comment is posted, and fails when the agent does not finish.
  • A run with no pull request, such as a push run, has nothing to comment on. Its agent jobs succeed and do nothing.
  • The agent acts for the person who started the run. It uses the model and the API key of the agent, not CI secrets, so an agent job runs in untrusted runs too.
jobs:
  test:
    image: node
    steps: [npm ci, npm test]

  review:
    needs: test
    agent: reviewer
    prompt: Check the change for missing error handling.

Steps

A step is a shell command, or a mapping with run and an optional name:

steps:
  - npm ci
  - name: Test
    run: |
      npm run lint
      npm test

If a step has no name, refs uses the first line of run, cut to 80 characters. Each step runs with bash in the root of the checkout.

Images

Images deploy with refs. A repository cannot bring its own image.

Each image is Debian bookworm with bash, git, curl, make, jq, zip and unzip, plus these tools:

Image Adds
base Nothing more.
node Node.js 24 and Python 3.
python Python 3.13, build-essential and uv.
go Go 1.25.
rust Rust stable, pkg-config and libssl-dev.
android JDK 17, Android platform 35 and build tools 35.0.0.

To pin a dated release, add @YYYY-MM, for example rust@2026-12. You can also write the name with the refs/ prefix, for example refs/node.

Sizes

lite, standard-1, standard-2, standard-3 and standard-4. These are Cloudflare Containers instance types. A larger size has more CPU and memory.

Secrets

A secret name uses capital letters, digits and _, and does not start with a digit. A job gets only the secrets that it names. refs looks for each name in this order and uses the first match:

  1. The environment of the job, if the job may use environment secrets.
  2. The repository.
  3. The namespace (CI secrets).

If a name has no value, the job log says so. The log never shows a value. refs replaces each value, and its base64 and URL-encoded forms, with ***.

Environment variables

Each step gets these variables:

Variable Value
CI true
REFS_SHA The full hash of the commit.
REFS_REF The ref of the run, for example the branch.
REFS_JOB The name of the job.
REFS_RUN_ID The ID of the run.

Job states

State Meaning
pending The job waits for its needs jobs.
waiting_image The job waits for its image.
waiting_approval The job waits for a person to approve its environment.
queued The job waits for a free container.
running The job runs.
succeeded Each step finished with exit code 0.
failed A step failed, or the job could not start.
skipped A job that it needs did not succeed.
cancelled A person cancelled the run, or rejected the job.
timed_out The job ran longer than timeout_minutes.

The state of a run comes from its jobs. A run fails if any job failed.

Full example

on:
  push:
    branches: [main]
  pull_request:
  manual:

jobs:
  test:
    image: node
    steps:
      - npm ci
      - npm test

  deploy:
    needs: test
    image: node
    environment: production
    secrets: [CLOUDFLARE_API_TOKEN]
    timeout_minutes: 15
    steps:
      - npm ci
      - npx wrangler deploy