Skip to content
Source
Sign inSign up

CI reference

CI / Reference

CI reference

You write or fix a workflow, and you need the exact rule of an option, a step, a limit, a command or a route. This page lists them, mostly in tables.

56 min read

To write a workflow step by step, start with Your first workflow.

Workflow files

  • A workflow is a .ts file directly in .source/workflows/. Its default export is defineWorkflow(...) with its jobs.
  • At plan time, a workflow file can import only @tanstack-source/ci, node: built-ins, other files in .source/, and src: modules (Share steps). Import the code of your repository inside a step.
  • The forge plans in a container with no network and no secrets, for at most 30 s.
  • .source/ can hold at most 2 MiB of files, and at most 500 files and folders.

defineWorkflow(name, options)

OptionDefaultWhat it does
nameUnique in the repository. Letters, digits, _, . and -, up to 64 characters. The first character is a letter or a digit.
onThe triggers. At least one, at most one manual() and at most one button().
env{}Environment variables of every job. It cannot replace a variable that the forge sets: see Environment variables.
cancelOlderRunstrueA new run cancels the older runs of this workflow on the same pull request or branch.
cancelOnClosetrueWhen a pull request merges or closes, the forge cancels the runs of this workflow on it that still run. With false, they keep running. See Runs of a closed pull request.
surface{ deleteFilesOnClose: false }The options of the workflow's surface on each pull request. With deleteFilesOnClose: true, the files of the surface are deleted when the pull request closes or merges. The Markdown stays.

Add each job with .job(name, options). A job name has the rules of a workflow name, and is unique in the workflow. A job that only requires other jobs is .requireAll(name, { needs }): see Jobs that require all jobs.

Runs of a closed pull request

A few seconds after a pull request merges or closes, the forge cancels each of its runs that still runs, hidden runs too. The reason of the run is The pull request was merged. or The pull request was closed.

  • The push run that the merge starts on the base branch keeps running.
  • A reopen of the pull request starts no run. Push, or run the workflow again.

A job that must finish after the merge, like a long benchmark, needs cancelOnClose: false in its workflow:

import { defineWorkflow, pullRequest } from '@tanstack-source/ci'

export default defineWorkflow('benchmark', {
  on: [pullRequest({ branches: ['main'] })],
  cancelOnClose: false,
}).job('bench', {
  steps: [{ name: 'Benchmark', run: './bench.sh' }],
})

The runs of this workflow keep running after their pull request merges or closes. Factory runs and agent jobs on the pull request stop in all cases.

When the plan fails

A plan fails when a workflow file does not load or breaks a rule. It also fails when a src: import cannot be used, when it pins a commit that no branch or tag of its repository holds, when the repository requires commit pins and an import names a tag or a branch, or when it is over one of the limits above. Then no job runs, and a push or a pull request records the errors as failed runs:

  • Each workflow file with errors gets a failed run with no jobs, named after the file, for at most 10 files. One run named plan gets all other errors.
  • The errors are the warnings of the run, at most 20 for each run.
  • The runs list shows the first error. In GET /ci/runs and list_ci_runs, planErrors holds the errors of the run. The run page and the checks of the pull request show them too.
  • A required check of the workflow stays pending. Such a run cannot run again: fix the errors, and push.
  • When the plan of the hidden workflows fails, the runs are hidden runs, for admins only.

A manual start (Run workflow, src ci start) is refused with the first error. On your machine, src ci plan shows the errors of your checkout.

Triggers

TriggerOptionsA run starts when
pullRequest({ branches, paths })branches: patterns of the base branch. paths: patterns of the changed files.A pull request opens, and at each push to its head branch.
push({ branches, tags, paths, skipCiPushes })branches, tags, paths: patterns. skipCiPushes (default false): ignore the pushes that a CI job made.A push moves a branch or a tag that matches. Without branches and tags, every push matches. With only one of them, only that kind of ref matches. A tag run checks out the commit of the tag, also for an annotated tag. A tag of a tree or a blob starts no run.
schedule(cron)Five fields, in UTC: minute, hour, day of the month, month, day of the week.The time of the schedule comes.
manual({ inputs })inputs: see Manual inputs.A person with write access starts it: Run workflow on the CI tab, src ci start, REST or MCP.
button({ inputs })inputs: see Manual inputs.A person with write access clicks a workflow button on a surface of an open pull request. It starts a pull request run on the head of the pull request, with the values of the button. See Start a workflow from a button.
after(workflow, { conclusion })conclusion: 'success' (default), 'failure' or 'any'.A run of the other workflow ends with that conclusion.

Patterns:

  • * matches any characters except /. ** matches any characters. ? matches one character that is not /.
  • A leading ! removes the values that it matches. The last pattern that matches a value decides.
  • A list needs at least one pattern without !. A pattern has at most 256 characters.
  • A paths filter matches when one changed file matches. A push of a tag ignores paths.
  • A change of more than 1,000 files matches every paths filter.

Rules of schedule() and after():

  • schedule(): only the plan of the default branch counts. The plan refuses a schedule that runs more often than every 5 minutes. A schedule that missed several times runs once. When the plan of the default branch fails, the repository has no schedules until a push fixes the plan.
  • after(): the name must be another workflow of the repository. The plan refuses an unknown name.
  • An after() run uses the same commit and ref as the run that ended.
  • A cancelled run starts no after() run. A run of a pull request from a fork starts none either.
  • A workflow runs at most once in one chain of after() runs.

Manual inputs

FieldInput typesWhat it does
typeall'string', 'boolean' or 'choice'.
descriptionallThe text of the input in the form.
requiredallA manual run, or a button, must give a value.
defaultallThe value when a run gives none. For 'choice', one of the options.
options'choice'The values to pick from. At least one.

button() takes the same fields. When a workflow has manual() and button(), only one of the two declares inputs, and both use them.

The steps get the values in ctx.inputs, with their types. An input with a default always has a value: runs of other events get the default.

Trust levels

The forge sets the level of each run. A workflow file cannot change it. Trust levels and secrets explains each rule.

EventLevel
Pull requesttrusted when the author has write access to the base repository, else untrusted.
Pushprotected on a branch whose branch rule requires a pull request, when the person has write access. trusted on any other ref, a tag included. untrusted without write access.
manual()protected on a branch whose branch rule requires a pull request, else trusted. It needs write access.
schedule()protected when the default branch has a rule that requires a pull request, else trusted.
button()The level of a run of the pull request: trusted or untrusted, from its author.
after()The level of the run that ended.
  • Only a branch whose branch rule requires a pull request gives a protected run. Any person with write access can push a tag, or a branch with no such rule, with their own code. A tag rule limits the tags that it matches to admins and protected runs.
  • A protected ref is the default branch, a tag, or a branch with any branch rule. A CI job pushes to one only in a protected run.
  • A run that a CI push starts gets the lower of two levels: the level of the run that pushed, and the level of the target.
  • A local run (src ci run) has the level local.

Job options

What runs, and where:

OptionDefaultWhat it does
needs[]Jobs declared before this one. They end first.
when'success''success': runs when all its needs passed, else is skipped. 'always': runs when all its needs ended, with any result. 'on-failure': runs only when one of its needs failed.
ifnone(ctx) => boolean. It runs in the job's container before the first step, with the ctx of the steps: the event, the ref, the inputs and the outputs of its needs. When it returns false, no step runs and the job is skipped. Its check run then shows success, with "skipped" in its title.
image'node''node' or 'browser'. See Images and sizes.
size'large', and 'small' in a public repository of an account that billing applies to'small', 'medium' or 'large'.
runsOnthe runner of the repository, else 'ravion''ravion', or the slug of an app installed on the repository with ci:runners. A pull request run takes it from the base branch, as it takes its secrets and egress. See Where jobs run.
dockerfalseWith true, the steps can start their own Docker daemon, for example to build images. The job runs only in a protected run. See Jobs that run Docker.
timeoutMinutes60A whole number from 1 to 120.
checkout{ depth: 1, lfs: false }depth: 0 checks out all the history. lfs: true checks out the LFS files. A job whose commit a force push or a deleted branch removed fails its checkout with not our ref: no branch, tag or other ref reaches the commit.
matrixnoneRuns the job once for each combination of the values. At most 256 cells.
taskCachetruefalse gives the job none of the variables of the task cache of Nx and Turborepo.
releasefalsetrue marks the job that ships the default branch, like a deploy. With the setting closeFixedIssues: release, its success on a push run of the default branch closes the issues that the merged pull requests fix. See Close fixed issues when the fix is live.
inputsnonePath patterns of the files that the job's result depends on, as the patterns of pullRequest({ paths }), 1 to 100. In a pull request run, the job takes the result of an earlier run where it passed when these files and the job did not change. See Reuse of unchanged jobs.

What the job can reach, and what it gives:

OptionDefaultWhat it does
secrets{}Secret names. A job with secrets that names no environment uses development. When its run cannot use development (pull requests and tags, by default), the job runs without optional secrets, or is skipped for a required one. {} is a required secret: with no value in the environment, the job is skipped. { optional: true } gives undefined there.
vars[]Names of CI variables, at most 100. The job gets each one that the repository has as an environment variable.
environmentnoneThe CI environment that the job deploys to, like 'production'. The job runs only when its run passes the environment's refs and lowest trust level, else it is skipped with the reason. Its secrets take their values in the environment, and its variables too, or their plain values where the environment has none. A pull request job takes it from the base branch.
egress[]Exact host names that the job reaches, on port 443. No other host.
apps[]Slugs of apps installed on the repository, at most 10. The job gets SOURCE_APP_TOKEN_<SLUG> for each one, a placeholder that the forge swaps for a signed job identity token in a header to the app's hosts. egress must list those hosts. A pull request job takes it from the base branch. See Use an app from a CI job.
permissionsnoneWhat the run token can write. See Permissions.
outputs[]Names that the steps set with ctx.setOutput. The jobs that need this job read them.
env{}Environment variables of the job, on top of the env of the workflow. It cannot replace a variable that the forge sets either.
stepsAt least one step.

Jobs that require all jobs

.requireAll(name, { needs }) adds a job that passes only when every job it needs passed. Require all jobs with one check shows it step by step.

.requireAll('checks', { needs: ['lint', 'test', 'build'] })
  • needs: at least one job declared before it. It takes no other option.
  • It passes when every cell of each job it needs passed. A cell that failed, was skipped or was cancelled makes it fail. Its summary names the jobs that did not pass.
  • It runs no steps and starts no container. The run decides it when the jobs it needs end, so it takes no container slot.
  • Its check run is <workflow>/<name>, with its summary and no job page. It can be a required check, and later jobs can need it.
  • src ci plan shows it as checks: requires all of lint, test, build. src ci run <workflow> <name> --with-needs decides it on your machine after the jobs it needs.

Jobs that run Docker

A job that builds or pushes images needs a Docker daemon of its own. Set docker: true, and start the daemon in a step:

.job('image', {
  docker: true,
  steps: [
    { name: 'Start Docker', run: './start-docker.sh' },
    { name: 'Build', run: 'docker build --network host -t app .' },
  ],
})
  • The CI images have no Docker. Your start-docker.sh installs it and starts dockerd in the background. Build images with Docker gives the flags of the daemon and the hosts.
  • The job runs only in a protected run. See Trust levels. In any other run, each cell of the job fails at once, unless the job's CI environment skips the run first (as production skips a pull request run). The cell fails with The job <name> sets docker: true, which runs only in a protected run (a run of a branch whose branch rule requires a pull request). This run is not protected.
  • The job container runs privileged on the job's own VM. On Ravion, the job also keeps a disk of its own. Set up Ravion for CI says what such a job can reach.

Steps

KindFieldsHow it runs
Commandname, run, env, workingDirectory, if, cachebash --noprofile --norc -eo pipefail, in the workspace or in workingDirectory.
Functionname, do, if, cacheThe runner awaits do(ctx). The step fails when it throws or rejects.
  • if(ctx) returns true or false, or a promise of one. With false, the step is skipped. Any other value fails the step.
  • cache: { inputs, outputs, key } or cache: { package, inputs, outputs, key } skips the step when its inputs did not change since a run of it that passed. cache can also be a function of the step's ctx that gives one. See Step cache.
  • When a step fails, the job fails, and the steps after it are skipped.
  • After the last step, the functions that steps gave to ctx.afterJob run, the last one first. When the job failed, only those with always: true run. One that fails fails the job.
  • Then the job reports its result. The saves of cache() run after that, with the same rules. A save that fails ends as a failed step, and does not change the result.

ctx

A function step gets ctx, typed from the job and the workflow.

Values:

MemberWhat it holds
eventThe trigger type: 'pull_request', 'push', 'schedule', 'manual' or 'after'. A run that a button started is 'pull_request'.
trust'untrusted', 'trusted', 'protected' or 'local'.
matrixThe values of the matrix cell of this job, with their exact types.
inputsThe values of the inputs of manual() or button().
needsFor each needed job, its result, and its outputs. For a matrix job, result and cells, each with matrix, result and outputs.
secretsA placeholder for each declared secret. The forge swaps it for the value only in the secret's header of requests to the hosts of the secret.
varsThe value of each CI variable that the job declares, or undefined when the repository does not have it.
envThe environment of the job.
base, head, refThe commit to compare with, the commit that the run tests, and the full ref of the run.
workspaceThe path of the checked-out repository.

What base is, by event:

  • Pull request: the head commit of the base branch when the run starts.
  • Push: the head of the last run of the same workflow that passed on that ref. If the workflow never passed there, the commit of the ref before the push. A new branch compares with the head of the default branch.
  • Push of a new tag, first push of the default branch, schedule() and manual(): empty.
  • after(): the base of the run that ended.

Functions:

MemberWhat it does
sh`...`Runs a command in bash, in the workspace. Each value in ${} is one shell word, and an array is one word for each item. A plain string runs as it is. Throws when the exit code is not 0.
sh.nothrow`...`The same, but returns { code, stdout, stderr } for any exit code.
setOutput(name, value)Sets a declared output. All outputs of a job take at most 1 MiB.
summary(markdown)Adds markdown to the job summary, at most 1 MiB.
afterJob(fn, { name, always })Runs fn after the last step, before the job reports its result, as a step with its own log. With always: true, it runs also when the job failed.
addPath(dir)Puts a folder first on the PATH of the steps after this one.
idToken({ audience })Returns a signed OIDC token (a JWT) for audience, good for 5 minutes. The job needs permissions: { idToken: true }. Throws in a local run, and when the forge refuses. See Deploy to a cloud with OIDC.
surface.set(key, { title, markdown, buttons })Sets one section of the surface of the workflow. See ctx.surface.
surface.file(name, path)Uploads a file to the surface of the workflow.

ctx.surface

Each workflow has one surface on each pull request: a card under the description, which its jobs write while they run. See Show results on a pull request.

MethodWhat it does
set(key, section)Replaces the section key, and leaves the other sections. A job sends at most one set a second for each key. The latest value wins, and the last value goes out before the job ends.
file(name, path)Uploads a file. path is relative to the workspace, or absolute. A section shows it with a relative link or image to name.
  • A key is a lowercase slug: a-z, digits and -, at most 40 characters.
  • A section has an optional title (at most 200 characters), markdown, and optional buttons.
  • PNG, JPEG, GIF and WebP show as images, and MP4 and WebM play on the card. Every other file is a download.
  • The first write of a new run clears the sections and files of the old run.
  • A run with no pull request writes nothing, and its step log shows one warning. A local run with the event pull_request prints the sections in the step log, and sends nothing.

A button is one of these:

ButtonFieldsA click
URLlabel, url, optional idOpens the https URL in a new tab. The card shows the host next to the label.
Workflowlabel, workflow, inputs, optional idStarts the workflow on the pull request, when it has a button() trigger. See Start a workflow from a button.
  • A label has at most 80 characters, and a URL at most 2,048.
  • The id is the slug of the label when you leave it out. Each id is unique in its section.
  • src pr surface <pr> [<workflow>] prints the surfaces. src pr surface click <pr> <workflow> <button> clicks a workflow button. Only people click: the forge refuses an agent's token.

Environment variables

Each job also gets these environment variables:

VariableValue
CItrue
FORCE_COLOR1, so tools print colors to the log, and the run page shows them. Set it to 0 in env to turn colors off.
TSS_TOKENThe placeholder of the run token. The forge swaps it only for its own git host and REST API.
TSS_FORGE_URL, TSS_REPOThe REST base for forge(), and the repository as owner/name.
NX_HEAD, NX_BASEctx.head, and ctx.base when it is not empty.
NX_SELF_HOSTED_REMOTE_CACHE_SERVER, NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKENThe task cache of Nx, and the fixed word tss-task-cache. Not set with taskCache: false, or when the job's env, secrets or variables set one of them.
TURBO_API, TURBO_TOKEN, TURBO_TEAMThe task cache of Turborepo, tss-task-cache and tanstack-source. Not set with taskCache: false, or when the job's env, secrets or variables set one of them.
TANSTACK_SOURCE_JOB_ID, TANSTACK_SOURCE_SHA, TANSTACK_SOURCE_REF, TANSTACK_SOURCE_REPOSITORYThe job, the commit, the ref and the repository. Each one also has a GITFLARE_ name.
TANSTACK_SOURCE_OIDC_REQUEST_URLThe URL that gives an OIDC token: curl "$TANSTACK_SOURCE_OIDC_REQUEST_URL?audience=<aud>" answers {"token":"..."}. The job needs permissions: { idToken: true }. It also has a GITFLARE_ name.

The env of a workflow or a job cannot replace a variable that the forge sets: CI, NX_BASE, NX_HEAD, and every TSS_*, TANSTACK_SOURCE_* and GITFLARE_* variable.

  • The job keeps the value of the forge, and runs.
  • The log of the first step starts with a warning that names the variables that the env tried to set.
  • The env of a command step can still set them, for that step only.

Built-in steps

Import them from @tanstack-source/ci. Each one returns a function step. Use it in steps, or call its do(ctx) in your own step.

Setup:

StepWhat it does
setup.node({ version })Puts the Node of version, else of .nvmrc or .node-version, first on the PATH. When the Node on the PATH is another version, it downloads Node from nodejs.org. A version can be 24, 24.3, lts/*, lts/<name> or node.
setup.pnpm()Puts the pnpm that packageManager in package.json names (like pnpm@10.4.1) first on the PATH, through corepack. Fails when packageManager names no pnpm.
setup.bun({ version })Puts the bun of version, else of .bun-version, first on the PATH. When the bun on the PATH is another version, it downloads that exact version from the GitHub release of bun.

Files and results:

StepWhat it does
cache({ key, paths, restoreKeys })Restores key, else the newest entry of the first prefix in restoreKeys that has one. When the job passes and no entry had exactly key, it saves paths as key after the job reported its result.
artifact({ name, paths, retentionDays })Uploads the files as one tar.gz artifact of the run. With no matching file, it uploads nothing and passes.
fixup({ message })Sends what the steps before it changed, compared with the tested commit. The forge commits it to the head branch of the pull request, or shows it as a suggested patch.
packagePreview({ npm, python, files })Packs the npm packages and uploads them, with the Python files and the other files, as a preview of the commit in the assets of the repository. A pull request shows an install line for each file on its Package previews card, and in its packagePreviews field. See Publish package previews of a pull request.
report({ file, text, format })Reads the output of a tool: a file of the workspace, or text. Adds its errors and warnings to the findings of the run.
syncWorkerSecrets({ names })Asks the forge to put the secrets that the job declares on the environment's Cloudflare Worker, all but CLOUDFLARE_API_TOKEN, or only names (each one declared). The forge sends the values to Cloudflare itself. See Sync the secrets of a Worker.

The rules of each:

StepRules
cache()A key has 1 to 512 printable ASCII characters. At most 10 restore keys. A path is relative to the workspace, under ~, or a glob, with no !. An entry is written once. A restore or save that fails is logged and does not fail the job. The cache scopes depend on the trust level. In a job container, an entry is a tar.zst that the step packs on every core, and a restore reads a large entry in several parts at once, straight into tar. In a local run, an entry is a tar.gz.
artifact()A name has 1 to 200 characters, with no /, \ or control character. A path outside the workspace fails the step. retentionDays is a whole number from 1, and can only make the time shorter.
fixup()The step fails when a change is in .source/, when the fixup is over 5 MiB, or when a submodule changed. The job needs no push permission. Pull requests from a fork lists when the forge commits it.
packagePreview()Give at least one list. Each entry is a path or a glob, relative to the workspace. An npm entry names a package folder with a package.json that has a name and a version. The step packs with pnpm when packageManager names pnpm, else with npm. It points dependencies and optionalDependencies on another package of the preview at that package's preview URL. It fails when a list matches nothing, when two files have the same name, or when the forge refuses an upload. Without the permission packages: 'preview', it uploads nothing, says why, and passes. A local run writes the files to ~/.cache/tanstack-source/package-previews/<short commit>/.
syncWorkerSecrets()Only a job of a protected run, not a pull request run, in an environment that names a Worker. A local run sends nothing.
report()As a step, it runs only when the steps before it passed. To report a tool that failed, call await report({ text, format }).do(ctx) in your step before the step fails.

report() formats. Without format, the step detects it.

formatReads
vitestThe JSON reporter of vitest (vitest run --reporter=json).
jestThe JSON output of jest (jest --json).
junitJUnit XML, from vitest, jest-junit, node --test, pytest and other test runners.
tscThe output of tsc, with --pretty false or without it.
eslintThe JSON output of eslint (eslint -f json).
playwrightThe JSON reporter of Playwright (playwright test --reporter=json).
logThe ::error, ::warning and ::notice lines of a log.

One report keeps at most 1,000 findings, and a message keeps at most 4,000 characters.

forge(ctx)

A client of the REST API of the forge, for the repository of the run. It reads TSS_FORGE_URL, TSS_REPO and TSS_TOKEN from ctx.env.

MethodWhat it doesPermission
pulls.list({ head, state, label })Lists the pull requests, every page. head is owner:branch for a fork.none
pulls.create({ title, head, base, body })Opens a pull request.pulls: 'create'
comments.create(number, body)Comments on an issue or a pull request.comment
issues.list({ label, state })Lists the issues, every page.none
issues.create({ title, body, labels })Opens an issue, then adds the labels.issues: 'write'
labels.ensure({ name, color, description })Gives the label with that name, or creates it.issues: 'write' to create
labels.add(number, names)Adds labels to an issue or a pull request, and creates the missing ones.issues: 'write'
  • A refused request rejects with a ForgeError, with the HTTP status and the message of the forge.
  • A read is tried again after a network error, a 5xx or a 429 (after 0.25 s, 1 s and 4 s). A write is sent once.
  • Without TSS_FORGE_URL, each write is a dry run: the step prints it, and sends nothing. Reads find nothing.

Step cache

cache: { inputs, outputs, key } on a run or do step skips the step when its inputs did not change since a run of it that passed, and restores its outputs. With package, the inputs are also the files of a workspace package and of the packages it depends on. Skip a slow step when its inputs did not change and Skip the tests of packages that did not change show it step by step.

Three steps of a steps list:

{ name: 'Build', run: 'pnpm build', cache: { inputs: ['src/**', 'package.json', 'pnpm-lock.yaml'], outputs: ['dist'] } },
{ name: 'Test the CLI', run: 'pnpm -C packages/cli test', cache: { package: 'packages/cli' } },
// A job with a matrix key `suite`:
{ name: 'Tests', do: async (ctx) => { await ctx.sh`pnpm -C packages/${ctx.matrix.suite} test` }, cache: (ctx) => ({ package: `packages/${ctx.matrix.suite}` }) },

The rules:

FieldRule
inputs1 to 100 paths or globs (*, **, ?) in the repository, or 0 to 100 with package. No !, no .., no / at the start, no ~. A folder stands for all its files.
packageOptional. The folder of a workspace package in the repository, like packages/cli. No glob, no . or .., no / at the start or the end, no ~.
outputsOptional. 0 to 100 paths, as the paths of cache(): relative to the workspace, under ~, or globs, with no !. A step with no outputs saves only that it passed.
keyOptional. 1 to 512 printable ASCII characters.
Other fieldsNone.
  • The define API and the forge refuse a step cache that breaks a rule, and the plan fails with the reason.
  • cache can be a function of the step's ctx that gives a cache. The plan shows it as { "atRunTime": true }, and the runner checks what it gives with the same rules.

Before the step runs, after its if, the runner makes the key:

  • The runner calls a function cache. When it gives a cache that breaks a rule, the step fails with the reason.
  • The key is step- and the sha256 of the step's name, its command and workingDirectory (a do step has none), the image of the job, key, and the path and content sha256 of each input file, sorted by path. In a job with a matrix, the values of the matrix cell are in it too, sorted by name. The folder of package is in it too, and a mark when the step has no outputs. The env of the step is not in it.
  • With package, the input files are also:
    • Every file of the package folder, and of each workspace package that it depends on, in turn. A dependency counts when its version in dependencies, devDependencies, optionalDependencies or peerDependencies starts with workspace:.
    • The root files pnpm-lock.yaml, package.json, pnpm-workspace.yaml, .npmrc and .nvmrc, when they exist.
    • Every file of .source/.
  • git lists the files of these folders (git ls-files --cached --others --exclude-standard), so ignored files are left out, and files that are not committed yet are in. Package names resolve to folders through the packages of pnpm-workspace.yaml, else the workspaces of the root package.json.
  • With package, a folder with no package.json, or a workspace: dependency that names no package of the workspace, fails the step.

Then the runner looks up the key:

  • When no file matches the inputs, the step runs and saves nothing.
  • The runner restores the entry of the key, with the cache scopes of cache(). Restore keys do not apply.
  • On a hit, the step does not run. It ends as passed, with (cached) after its name, and its log says Restored the outputs from the cache step-<hash>. This step did not run. What the step does besides its outputs does not happen: ctx.setOutput, ctx.summary, ctx.addPath and ctx.afterJob.
  • On a miss, the step runs. When it passes, the runner saves its outputs as the key right after the step, so a later step cannot change them, also when a later step fails. A step with no outputs saves an entry that says only that it passed. A step that fails saves nothing.
  • A restore or a save that fails is logged, and does not fail the step.

Where the step cache works differently:

  • A job of a hidden workflow neither restores nor saves: its steps always run. The forge refuses its saves too.
  • A local run (src ci run) uses the cache folder of the machine, as cache() does.
  • A wrong inputs list gives a wrong hit: a change to a file that the step reads, but that is not in inputs, does not run the step. The Timing card of a job shows each step that came from the cache.

Reuse of unchanged jobs

A job of a pull request run does not run when nothing that can change its result changed since a run of the same pull request where it passed. It ends as passed, with the outputs and the summary of that job, and starts no container. Skip jobs that nothing changed for shows it step by step.

.job('test', { inputs: ['packages/**', 'pnpm-lock.yaml'], steps: [{ name: 'Test', run: 'pnpm test' }] })

The key:

  • inputs: 1 to 100 patterns, as the patterns of pullRequest({ paths }), with ! patterns. The forge refuses an empty list and a bad pattern, and the plan fails with the reason.
  • The forge computes the key of each job cell, never the job. It is the sha256 of: the git path, mode and id of each file that matches inputs in the head commit of the pull request (the id of the whole tree without inputs), the id of the .source folder of that commit, the job's entry of the plan, its secret and variable names, environment, permissions and egress, the env of the workflow, its matrix cell, the results and outputs of the jobs it needs, the pull request, its head branch, and the commits of the extra checkouts. The values of secrets and variables, and the base commit, are not in it.
  • The forge walks at most 50,000 files and folders of a commit for inputs. In a larger commit, the jobs with inputs run.

Which runs reuse a result:

  • Only pullRequest() runs reuse a result or give one. Push, schedule(), manual() and after() runs always run their jobs. So do hidden workflows and private pull requests.
  • Only a job that passed gives a result. A failed, cancelled or skipped job gives none.
  • A run reuses only a result of a run at its own trust level or a higher one (protected > trusted > untrusted).
  • A re-run of a run or of a job always runs it.

What a reused job shows:

  • A reused job has reusedFrom: { run, job, jobId } in the run JSON and in its timing, no timed parts, and no log, findings or artifacts of its own. Its check passes, with "Unchanged since run <run>" in its summary.
  • The forge keeps the newest 10,000 results of each repository.

Permissions

A job declares permissions. The default is none: the run token only reads. The trust level of the run sets a ceiling.

PermissionWhat it allowsuntrustedtrustedprotected
noneRead the repository.yesyesyes
comment: 'own-pr'Comment on the pull request of the run.noyesyes
comment: 'any-pr'Comment on any pull request.nogets 'own-pr'yes
push: 'own-pr'Push to the head branch of the pull request of the run.noyesyes
push: ['<pattern>', ...]Push to the branches that match. 'tags' means all tags.noyes, but not to a protected refyes
issues: 'write'Create and edit issues, and change their labels.nonoyes
pulls: 'create'Open pull requests.nonoyes
packages: 'preview'Publish package previews of the run's commit in the assets of the repository. A private pull request and a hidden workflow do not get it.noyesyes
idToken: trueAsk for an OIDC token with ctx.idToken(), to trade with a cloud for keys. A private pull request and a hidden workflow do not get it.noyesyes

The run shows a warning for each permission that its level takes away. The forge audits each write with the run, the job and the person who started the run.

Images and sizes

ImageWhat it has
nodeDebian 13, Node 24, corepack (pnpm, yarn), bun, git, git-lfs, jq, python3, build-essential, curl, unzip, xz-utils and zstd.
browserThe node image, plus Playwright 1.57.0 with Chromium, Firefox and WebKit in /ms-playwright.

The images are for linux/amd64, and the steps run as root.

The forge copies the runner into each container when the job starts, so the runner is not part of an image.

In both images, fetch in Node 22.19 and later goes through undici 8. The fetch of Node 24 (undici 7) can stop the whole process with assert(!this.paused) when a server closes the connection during a slow download, as when corepack unpacks pnpm. A step whose env sets NODE_OPTIONS keeps the fetch of its Node.

In both images, npm, pnpm and bun reach the npm registry over plain http inside the container, 64 requests at a time. /root/.npmrc and /root/.bunfig.toml set this. The job's egress still fetches from the registry over https. A project's own .npmrc or bunfig.toml wins over these files. A job opens a new connection for each request, so a large install with https spends much of its time on TLS handshakes. With http and 64 requests at a time, a cold install of TanStack/ai took 68 s, against 140 s.

SizevCPUMemory
small16 GiB
medium28 GiB
large412 GiB

In a private repository, a job is large by default: 4 vCPU, as a GitHub runner has. A package install links thousands of files, and more vCPU makes it faster. Give a job that only runs a short script size: 'small' or size: 'medium'. In a public repository, a job that sets no size is small, because only small jobs are free CI there. An account that a site admin made exempt from billing keeps large. Set size: 'large' to get 4 vCPU: the job is then paid CI. See Free CI for public repositories.

In a large job, each Node process gets a heap of 4 GiB, as on a GitHub runner. To do this, the forge sets NODE_OPTIONS=--max-old-space-size=4096. Node gives itself 4 GiB only on a machine with 16 GB of memory or more. In 12 GiB it takes about 2 GiB, and a large build can stop with JavaScript heap out of memory.

If several Node processes fill their heaps at the same time, the job runs out of memory. A NODE_OPTIONS variable of the repository replaces this value. So does an env of the workflow, the job or a step that sets NODE_OPTIONS.

Where jobs run

Each job runs on a runner. Pick where CI jobs run shows how to pick one, and what each runner costs.

RunnerrunsOnWhere the job runs
Ravion'ravion'In a fresh VM on EC2, through Ravion, after a site admin set it up. The default.
A runner appthe slug of the appIn a fresh VM of the app. See Run Source CI jobs on your machines.

For each job, the forge takes the first runner that one of these names:

  1. The runsOn of the job.
  2. The runner of the CI settings of the repository (src ci settings --runner <name>).
  3. Ravion.
  • A job of a hidden workflow, or of an untrusted run, never runs on an app. When its runner is an app, it runs on Ravion.
  • A runsOn that names no runner fails the job before it starts. cloudflare names no runner. The plan refuses a runsOn that is not a runner name: letters, digits, _, . and -, up to 64 characters.

On Ravion, a CI job runs in the US East environment (AWS us-east-1), next to the primary git server, the database and object storage, so where the people of a repository are does not matter to its CI. A job reads and saves its cache in object storage there. A repository that a site admin gave an environment of its own runs its jobs in that environment.

Limits

Jobs:

LimitValue
Matrix cells of a job256
timeoutMinutes1 to 120. The default is 60.
Log of a job128 MiB over all its steps. The forge keeps no log bytes past it.
Outputs, and the summary, of a job1 MiB each
Outbound requests of a job50,000. A request past it gets 429, and the job error says why. The forge audits the first 500 requests one by one, and counts the rest by host. See The egress audit.
CI pushes in a row3. A CI push past that starts no job: it shows a failed run with the reason. Push by hand to run the checks again.

A job can lose its container while it runs, for example because AWS took back a spot host. The job then ends with the error "The job lost its container", and the forge runs its cell again, in a new job on a new machine. A job on Ravion ends the same way when Ravion fails to start its VM with a server error or no answer. When Ravion answers with its rate limit (429), the job first waits and asks again, for up to 4 minutes: the first wait is 10 s, and each next wait is two times as long. When Ravion still answers 429, the job ends the same way. A VM on Ravion takes its job with a one-time claim that works for 10 minutes. When no VM took it 12 minutes after the job asked for one (Ravion was short of hosts), the job ends the same way, so its slot does not wait any longer. A cell gets at most 3 machines in all, and a re-run of the cell counts too. When the job on its last machine loses its container as well, the cell ends as an error, and its reason says which machine it was.

Storage:

LimitValue
Artifact1 GiB each, and 5 GiB for each run
Artifact retention30 days, and 90 days for a protected run
Log retention90 days after the job ends, by default. Then the logs of the job and the start and end of each step go. Its result, its summary and its findings stay. A site admin changes the time for the whole forge. See Set the limits of the site.
Run retention1 year after the run ends, by default. Then the run goes, with its jobs, logs and artifacts. A site admin changes the time for the whole forge.
Cache of a repository50 GB. The least recently used entries go first.
Cache entry5 GiB less 5 MiB
fixup()5 MiB
Package previews100 MiB for each file by default, in the 10 GiB of assets of the repository. Deleted 3 to 4 days after the pull request closes or merges, or after the first upload of a run with no pull request.

Surfaces:

LimitValue
Sections20 for each surface
Markdown64 KB for each section
Buttons10 for each section
Files10 MB for each file, 50 MB for each surface

The queue: each account has a queue of its own, and its repositories take turns. A job past a limit waits in the queue. It does not fail. The jobs of software factory runs wait in the same queue, and these limits count them too. No limit covers the whole forge.

When a slot is free, the jobs of protected runs and the serialized jobs go first: a push or a manual run on a branch whose branch rule requires a pull request, a schedule when the default branch has such a rule, and each job that src ci settings --serial-job names, such as a deploy. They go before the other jobs of the account, such as the jobs of pull requests, even when those came first. So the checks of the default branch and its deploy take the next free slots, and do not wait for the pull request jobs that wait. A job that already runs keeps its slot. Among the jobs that go first, and among the others, the repositories still take turns: the one with the fewest jobs running goes first, then the job that waited longest. A job that goes first still keeps to the limits of its repository and its account.

A CI job runs on Ravion or on a runner app, so it takes no container. It waits in a lane of the queue of its own, and the container limits do not count it. In that lane, an account that pays (a paid plan, credits, or an exemption from billing) runs at most the Remote CI jobs per account of the site at once, 1,000 by default. Another account runs as many jobs there as its container limits allow. The container limit of a repository (src ci settings --containers <n>) holds in both lanes.

These are the limits of the site. A site admin sets them on Admin > Limits. When no site admin set a limit, the deploy sets it. This deploy sets 5 containers for one account and 5 for one repository. The table shows the defaults, for when neither sets a value. See CI and AI.

Containers at the same timeDefault
For one account (the owner of the repositories)20
For one repository20. Lower it with src ci settings --containers <n>.
For the untrusted jobs of one fork author, in all accounts4, and 4 hours of container time each UTC day. The factory jobs on the items of an author without write access count here too.

A site admin can give one account its own container limit. That limit replaces the limits for one account and for one repository, for each repository of the account. A repository can still lower it with src ci settings --containers <n>. See Give one account higher limits.

When a site admin lowers a limit, the jobs that run keep their containers. Only new jobs wait for the lower limit.

While billing is on, the plan of the account sets the limit for one account and the limit for one repository. Free has 5 containers, Pro 10, Team 20 and Enterprise 50. So one repository can use all the containers of the plan. A container limit that a site admin gave the account still wins over both.

The container limit of a repository (src ci settings --containers <n>) can be at most the limit of its account for one repository. src ci settings shows that limit. While billing is on, it is the number of containers of the plan, for example 10 on Pro.

While billing is on, an account with nothing left starts none of its paid CI. Its paid CI is the CI of its private repositories, the medium and large jobs of its public repositories, and public CI past 20,000 CI minutes in the period. Each job that waits fails with "No CI minutes left this month.", then the next step for the account, such as "Buy credits or turn on overage on the Billing page", and the address of the page. A small job of a public repository does not fail for billing while the account has free public CI left. See When nothing is left.

Settings:

LimitValue
CI secrets100 for each repository, 16 KiB for each value, 10 hosts for each secret
CI variables100 for each repository, 48 KiB for each value, 256 KiB for the variables of one job
CI environments20 for each repository, 20 refs for each environment
Branch rules100 for each repository, 50 required checks for each rule
Approval gates50 for each repository
Merge queue check timeout1 to 120 minutes. The default is 60. When the checks of the front pull request of the merge queue do not finish in that time, the pull request leaves the queue. Change it with src ci settings --queue-timeout <minutes>, and go back to 60 with --clear-queue-timeout.
Close fixed issuesmerge (the default) or release. merge closes the issues that a pull request fixes when it merges into the default branch. release keeps them open and Staged until a job with release: true succeeds on a push run of the default branch. With no such job in the workflows of the default branch, they close on merge. Change it with src ci settings --close-fixed-issues <merge|release>. See Close fixed issues when the fix is live.
Allowed workflow sources100 for each repository
Require commit pinsOn or off. When it is on, each src: import of the workflows names a commit (src:<owner>/<repo>@<commit>/<path>.ts), not a tag or a branch. It is on by default for a repository created on or after 2026-11-26, and off for an older one. Change it with src ci settings --commit-pins <on|off|default>. Whatever it says, a pinned commit must be on a branch or a tag of its repository. See Pin shared modules to commits.
src: modules in one plan1 MiB of files, 100 files, 8 imports deep

gh commands for CI

src has gh's run, workflow, cache, secret, variable and agent-task commands. They use your src login and the repository of your clone. For another repository, add -R <owner>/<repo>.

Runs:

CommandWhat it does
src run list [-w <workflow>] [-b <branch>] [-s <status>] [-e <event>] [-u <user>] [-c <commit>] [-L <n>] [--all]Lists the runs, 20 by default. A status is one of gh's, like in_progress or failure. With --all, -w can name a disabled workflow.
src run view <run> [-j <job>] [--log | --log-failed] [-v] [--exit-status]Shows a run and its jobs, one job, or the logs. -j takes the job key, like test (shard: 1), or the job id. A share of the pull request at level page sees the run and the states of its jobs: src shows them, and says that it cannot show the steps and the artifacts.
src run watch <run> [-i <seconds>] [--compact] [--exit-status]Follows the live event stream of the run, and shows the run again at each change, until it ends. On a server with no event stream, it shows the run every -i seconds (3 by default). To follow the log of one job, use src watch job. See Wait for CI and pushes with src.
src run rerun <run> [--failed] [-d], src run cancel <run>Runs a run again, or only its jobs that did not pass, with the jobs that need them. With -d (--debug), each job keeps its container for 15 minutes after its last step. See Debug a job in its container. Or cancels a run.
src run download <run> [-D <dir>] [-n <name>]... [-p <pattern>]...Saves the artifacts of a run, from every job of each attempt. Each artifact is one file, <dir>/<name>. src never replaces a file. When a rerun saved an artifact with the same name again, it saves the newest. A name is unique in its job only: when two jobs of the run kept an artifact with the same name, it saves each in a folder of its job, like <dir>/test-shard-1/report.txt, and says so on stderr. src compares names as macOS and Windows do: two names that differ only in letter case are one name, so a download gives the same files on every system. One folder cannot hold two names of one job that differ only in letter case: src saves the newest. A job's folder has at most 100 bytes, and a longer key keeps its start and a short hash. When another job, a file of the download or a file in <dir> has the folder's name, or it is the name of a Windows device like con, the folder ends with -2, -3 and so on. Some older runs do not name the job of an artifact of an earlier attempt: when another artifact has its name, src skips it. For each artifact that it skips, src says so on stderr, with the src ci artifact command that saves it.
src run delete <run>Deletes a run that ended. See Delete a run.

Workflows, cache, secrets, variables and agent tasks:

CommandWhat it does
src workflow list [--all], src workflow view <workflow> [--yaml] [-r <ref>]Lists the workflows of the default branch, or shows one with its recent runs. --yaml prints the workflow file.
src workflow run <workflow> [-r <ref>] [-f <name>=<text>]... [-F <name>=<value>]... [--json]Starts a workflow that has a manual() trigger. --json reads the inputs from stdin, as a JSON object.
src workflow enable <workflow>, src workflow disable <workflow>Turns a workflow on or off. See Turn a workflow off.
src cache list [-k <prefix>] [-r <ref>] [-S <field>] [-O asc|desc] [-L <n>]Lists the cache entries, 30 by default.
src cache delete <key> [-r <ref>], src cache delete --all [-r <ref>]Deletes the entry of a key in every scope, or only in the scope of -r. --all deletes every entry.
src secret list, src secret set <name>, src secret delete <name>See Add a secret. set needs --env. --host and --header bind a secret so that jobs can send it, --in-body lets it go in request bodies, and --unbind removes the binding. With no host, a secret is only stored. With --env preview --branch <branch>, they set and delete the preview value for one branch.
src secret audit [--name <name>] [--env <env>] [-L <n>]Who wrote, read or deleted which secret value, newest first. Admins only. See The secret audit.
src variable list, src variable get <name>, src variable set <name>, src variable delete <name>See CI variables. People with write access list and get the variables. Admins set and delete them.
src env list, src env set <name>, src env delete <name>See CI environments. --env <name> on the secret and variable commands names an environment's value.
src env cloudflare <environment> [--disconnect] [--json]Shows the Cloudflare connection of an environment: its status, account, Worker, and who connected it and when. --disconnect deletes it and revokes its token. Admins only. Connecting is on the web only. See Connect Cloudflare.
src agent-task create <task> -a <agent>, src agent-task list [-L <n>], src agent-task view <id>Gives a task to an agent, lists the agent jobs of the repository (newest first), or shows one. list takes no -R: it uses the repository of your clone.
  • A workflow is its file name, like nightly.ts, or its name.
  • A -r of the cache commands is refs/heads/<branch>, refs/pull/<n>/merge or protected.
  • --json, --jq and --template work with run list, run view, workflow list, cache list, secret list, variable list and variable get. See Use src in scripts and agents.

Turn a workflow off

src workflow disable nightly.ts stops a workflow from starting runs. src workflow enable nightly.ts turns it on again.

  • A disabled workflow starts no job: not from its triggers, and not by hand. A push or a pull request shows a failed run with no jobs and the reason. A manual start is refused.
  • It still plans, so a required check of it stays pending.
  • Only an admin of the repository turns a workflow on or off. On the web, admins use the switch of the workflow under Workflows on the CI settings page.
  • src workflow list shows a disabled workflow only with --all.

Delete a run

src run delete <run> deletes a run with its logs, its artifacts and the records of its jobs.

  • Only an admin of the repository deletes a run.
  • The run must have ended. If it has not ended, cancel it first with src run cancel <run>.
  • A run of a pull request cannot be deleted, because the required checks of the pull request read it. A run of a failed plan cannot be deleted either.
  • The run goes at once. Its jobs, logs and artifacts go in the background after that.
  • The check results of the run on its commit stay.

The forge also deletes each run by itself, at the end of the run retention: 1 year after the run ends, by default. This includes the runs of pull requests and of failed plans.

src ci commands

The src binary is in the npm package @tanstack-source/cli. src ci help shows the same list.

The commands that act on the forge use your src login and the repository of your clone, like the other src commands:

  • To use another repository of the same forge, set TSS_REPO=<owner>/<repo>.
  • To use another token, set TSS_TOKEN. It wins over the token of your login.
  • To use another forge, set TSS_FORGE_URL (the REST base, like https://forge.example/api/v1), TSS_TOKEN and TSS_REPO. When TSS_FORGE_URL is set, src ci uses only these three variables.
  • src ci run --live gives its steps only a TSS_TOKEN that you set, never the token of your login.

On your machine. plan, run and convert work without the forge. sync, update and --repro act on the forge:

CommandWhat it does
src ci plan [--json]Plans the workflows, and shows their jobs or the errors. --json prints the plan as JSON.
src ci run <workflow> <job>Runs one job. Flags: --matrix <key>=<value>, --input <name>=<value>, --with-needs, --docker, --print (with --docker), --live. See Run CI jobs on your machine.
src ci run --repro <run>/<job>Runs a job of a forge run again, with its matrix cell, inputs and needs. See Run a forge job again on your machine.
src ci convert [<file>...] [--force]Converts GitHub Actions workflows into .source/workflows/*.ts. See Move from GitHub Actions.
src ci syncDownloads the src: modules that src.lock pins into .source/.modules/.
src ci update [<owner>/<repo>@<ref>...] [--pin]Pins src: imports to the commits of their refs now, shows what changed, and syncs. --pin also writes each import of a tag or a branch as its commit, with the tag or branch in a comment.

Runs and jobs. These, and every command below, act on the forge:

CommandWhat it does
src ci runs [--workflow <name>] [--pr <n>] [--branch <name>] [--status <status>] [--limit <n>] [--cursor <next>]Lists the runs, the newest first. A status is planning, waiting_approval, queued, running, completed or cancelled.
src ci view <run> [--job <job>] [--log | --log-failed]Shows a run and its jobs, one job, or the logs of its jobs.
src ci logs <run> <job> [--step <n>] [--from <line>] [--to <line>]Prints the log of a job, or some of its lines.
src ci timing <run> [--job <job>] [--json]Shows where the time of each job of a run went, and how fast each job was against its last 10 successful runs. See Find out where your CI time goes.
src ci findings <run> <job>Shows the errors and warnings that a job found.
src ci rerun <run> [--failed] [--debug]Runs a run again, or only the jobs that did not pass. With --debug, each job keeps its container for 15 minutes after its last step.
src ci exec <run> <job> [--cwd <dir>] -- <command>Runs a command in the container of a job, while it runs or in its debug window. The exit code is the exit code of the command. --done ends the debug window. See Debug a job in its container.
src ci shell <run> <job> [--cwd <dir>]Runs the lines that you type in the container of a job, one at a time. It is not a full terminal: no prompts, no editors.
src ci cancel <run>, src ci approve <run>Cancels a run, or approves a run that waits for a person. The forge also cancels the runs of a pull request that merges or closes: see Runs of a closed pull request.
src ci start <workflow> [--ref <ref>] [-f <name>=<text>]... [-F <name>=<true|false>]...Starts a workflow that has a manual() trigger, with its inputs.

Artifacts, pull requests and agent jobs:

CommandWhat it does
src ci artifacts <run> <job>Lists the artifacts of a job.
src ci download <run> <job> [--name <name>]... [--dir <dir>]Downloads the artifacts of a job into a folder. The default is the current folder.
src ci artifact <id> [--dir <dir>]Downloads one artifact by its id.
src ci checks <pr>Shows the required checks of a pull request, and whether it can merge.
src ci check-runs [--sha <commit>]Lists the check runs of a commit. The default is the commit that you checked out.
src ci fixups <pr>, src ci fixup apply <id>Lists the fixups of a pull request, or applies a suggested one.
src ci maintainer-edits <pr> [--on | --off]Shows or sets whether maintainers and CI fixups can change the pull request.
src ci job start --agent <name> --prompt <text> [--ref <ref>] [--pr <n>] [--egress <host>]..., src ci job view <id>Starts an agent job, or shows a job.

Settings of the repository:

CommandWhat it does
src ci rule list, src ci rule delete <pattern>Lists the branch rules, or deletes one.
src ci rule set <pattern> [--require-pull] [--check <workflow>/<job>]... [--up-to-date] [--skipped-passes] [--approvals <n>] [--code-owners] [--dismiss-stale] [--linear-history]Sets the branch rule of a pattern. A flag that you leave out is off. See Require reviews before a merge for the review rules.
src ci tag-rule list [--json], src ci tag-rule set <pattern>, src ci tag-rule delete <pattern>Lists, sets or deletes the tag rules.
src ci source list, src ci source add <owner>/<name>, src ci source remove <owner>/<name>Lists, adds or removes the allowed workflow sources.
src ci cache list, src ci cache delete --scope <scope> | --key <key> | --allLists the cache entries, or deletes them. A scope is protected, branch:<name> or pr:<n>.
src ci cache suggestStarts the CI caches agent: it opens a pull request that caches the steps. See Get a pull request that caches your CI steps.
src ci settings [--runner <name> | --clear-runner] [--containers <n> | --clear-containers] [--gate <job>]... [--no-gates] [--serial-job <workflow/job>]... [--no-serial-jobs] [--queue-timeout <minutes> | --clear-queue-timeout] [--commit-pins <on|off|default>] [--close-fixed-issues <merge|release>]Shows or changes the runner, the container limit, approval gates, serialized jobs, the merge queue check timeout, whether src: imports must name commits, and when fixed issues close. The runner is for the jobs that name no runsOn: ravion or the slug of an app installed with ci:runners. --clear-runner goes back to the default runner, Ravion. A serialized job uses workflow/job and runs one at a time across runs, without blocking unrelated checks. A gate is <job> or <workflow>/<job>.
  • --json prints the answer of the forge as it is. It works with runs, view, findings, artifacts, job view, check-runs, checks, fixups, maintainer-edits and each list command.
  • Short flags: -w (--workflow), -b (--branch), -s (--status), -L (--limit), -j (--job), -r (--ref), -n (--name), -D (--dir).
  • The exit code is 0 when the command did its work, and 1 when it failed. It is 2 when the command line is wrong. For the commands of the forge, it is 2 also when src finds no login or no repository, and a TSS_* variable is missing.

REST and MCP

The REST routes are under /api/v1/repos/<owner>/<repo>. Each MCP tool calls the same method as its route. A job key has its matrix cell, like test (shard: 1).

Runs and jobs:

RESTMCP tool
GET /ci/runs?workflow=&pull=&ref=&status=&event=&user=&limit=&cursor= (event: push, pull_request, schedule, manual, button or after. user: the username of the person who started the run)list_ci_runs
GET /ci/runs/<run> (each job has reusedFrom, see Reuse of unchanged jobs)get_ci_run
GET /ci/runs/<run>/timing?job=get_ci_run_timing
POST /ci/runs/<run>/approve, /cancel, /rerun ({ "failedOnly": true, "debug": true })approve_ci_run, cancel_ci_run, rerun_ci_run
POST /ci/runs/<run>/jobs/<job>/exec ({ "command", "cwd" }, or { "done": true })exec_in_ci_job
DELETE /ci/runs/<run>delete_ci_run
GET /ci/workflows, GET /ci/workflows/<workflow>list_ci_workflows, get_ci_workflow
PUT or DELETE /ci/workflows/<workflow>/enabledset_ci_workflow_enabled
POST /ci/workflows/<workflow>/runs ({ "ref", "inputs" })start_ci_workflow
GET /ci/runs/<run>/jobs/<job>/logs?step=&from=&to= (1,000 lines by default)read_ci_job_log
GET /events?scope=job&job=<job id> (a live stream), or GET /events/wait?scope=job&job=<job id> (a long poll): a log event each time a step of the job gets new lines. See Wait for changes over REST.wait_for_events with scope: "job"
GET /ci/runs/<run>/jobs/<job>/findingsget_ci_job_findings
GET /ci/runs/<run>/jobs/<job>/artifactslist_ci_job_artifacts
GET /ci/runs/<run>/artifacts: the artifacts of every job of the run, from each attempt, newest first. Each names the key of the cell of its job in job, like test (shard: 1), or null for a job of an earlier attempt that an older run does not name. A rerun keeps the artifacts of the jobs it replaced, so the first of each name of a job is the newest.list_ci_run_artifacts
GET /ci/runs/<run>/jobs/<job>/reproget_ci_job_repro
GET /artifacts/<id> (with Range)get_artifact

In GET /ci/runs, any other event gets 400, and an unknown user gets an empty list. The CI tab has the same filters above its runs: Workflow, Branch or tag, Pull request, Status, Event and Started by.

The X-Log-Steps header of the logs route, and steps in read_ci_job_log, give each step of the log:

  • step (from 0), name, and lines.
  • startedAt: when the step started, in ms since 1970. It is null for a step that the runner did not report, and for a step of a job from before the forge kept the start of steps.
  • finished: the log of the step ended.
  • conclusion (success, failure or skipped) and durationMs: null until the step ends.

A step skipped because an earlier step failed has no lines. name is null for a step that the runner did not report. The header escapes each character that is not ASCII, like é.

The run lists read an index of the runs, which can lag behind a run by a few seconds:

  • GET /ci/runs, list_ci_runs, src ci runs and the CI tab show a new run, or a change of a run, after those seconds.
  • Until the index has a new run, the routes of that run answer 404. This includes a run that POST /ci/workflows/<workflow>/runs started.
  • When the index has a run, GET /ci/runs/<run> gives its current state.

Pull requests, check runs and agent jobs:

RESTMCP tool
GET /pulls/<n>/checksget_pull_request_checks
GET or PUT /pulls/<n>/maintainer-edits ({ "allowed" })get_maintainer_edits, set_maintainer_edits
GET /pulls/<n>/fixupslist_pull_request_fixups
POST /ci/fixups/<id>/applyapply_ci_fixup
GET /pulls/<n>/surfacesget_pull_surfaces
POST /pulls/<n>/surfaces/<workflow>/buttons/<button>/click ({ "hidden": true } for a hidden workflow)click_surface_button
GET /check-runs?sha=list_check_runs
POST /jobs, GET /jobs/<id>start_job, get_job
GET /jobs?kind=agent&limit=&cursor=list_agent_jobs

Settings:

RESTMCP tool
GET /ci/secrets, PUT /ci/secrets/<name> ({ "environments", "hosts", "header" }), answering droppedEnvironments, DELETE /ci/secrets/<name>[?environment=]list_ci_secrets, set_ci_secret, delete_ci_secret
PUT /ci/secrets/<name>/branches/<branch> ({ "value" }), DELETE /ci/secrets/<name>/branches/<branch>: the preview value for one branch, with secrets:previewset_preview_secret, delete_preview_secret
GET /ci/secrets/<name>?environment= (the environment's readers, never production)get_ci_secret
GET /ci/secrets/audit[?name=&environment=&limit=&cursor=]: the secret audit, admins onlylist_ci_secret_audit
GET /ci/variables[?environment=], GET or DELETE /ci/variables/<name>[?environment=], PUT /ci/variables/<name> ({ "value", "environment", "public" })list_ci_variables, get_ci_variable, set_ci_variable, delete_ci_variable
GET /ci/environments, PUT or DELETE /ci/environments/<name> ({ "refs", "minTrust", "readers", "worker" }), a PUT answering droppedSecretslist_ci_environments, set_ci_environment, delete_ci_environment
GET /ci/environments/<name>/values (the environment's readers, never production)pull_ci_environment
POST /ci/environments/<name>/rotate-key (a new encryption key for the secret values of the environment, for admins), answering keyVersion, reencrypted and retiredKeysrotate_ci_environment_key
GET or DELETE /ci/environments/<name>/cloudflare: the Cloudflare connection of the environment, admins only. GET answers { connection, configured }, DELETE answers { disconnected, revoked, message }get_cloudflare_connection, delete_cloudflare_connection
POST /vault/rewrap (after a rotation of the vault master key, it puts the vault keys of the repository under the current master key, for admins), answering rewrapped, remaining and masterKeyIdsrewrap_vault
GET /ci/rules, PUT or DELETE /ci/rules/<pattern> ({ "requirePull", "requiredChecks", "requireUpToDate", "skippedCountsAsPassed", "requiredApprovals", "requireCodeOwnerApproval", "dismissStaleApprovals", "requireLinearHistory" })list_branch_rules, set_branch_rule, delete_branch_rule
GET /tag-rules, PUT or DELETE /tag-rules/<pattern>list_tag_rules, set_tag_rule, delete_tag_rule
GET or POST /ci/sources ({ "source": "owner/name" }), DELETE /ci/sources/<owner>/<name>list_ci_sources, add_ci_source, delete_ci_source
GET /ci/cache, DELETE /ci/cache?scope=&key=list_ci_cache, delete_ci_cache
GET or PUT /ci/settings ({ "runner", "containers", "approvalGates", "serializedJobs", "mergeQueueTimeoutMinutes", "requireCommitPins", "closeFixedIssues" }), answering defaultRunner and hasReleaseJob too. requireCommitPins is null for the default. runner is null for the default runner, and defaultRunner is ravion.get_ci_settings, set_ci_settings

Who can:

  • Everyone who can read the runs lists the workflows and the agent jobs.
  • People with write access read the CI variables. Admins set and delete them.
  • Admins turn a workflow on or off, and delete a run. A run of a pull request, or a run that has not ended, gets 422.

Two MCP prompts help agents: fix_ci_run fixes a failed run, and convert_github_actions moves workflows from GitHub Actions.