spindle
GitHub

Threads

CI that lives in the repository.

A workflow is a file at .spindle/workflows/ci.yml. A branch push, a tag push, a pull request, a release, an issue, a schedule, an API dispatch or a button creates a run; registered runners execute each job in its own container; every job reports one check into the surface that already gates merges. No public marketplace to trust blindly — remote actions resolve only under an operator policy (default-deny) and are pinned and audited — a cache scoped to the run's trust class, no second service to operate — and no state outside the object store.

.spindle/workflows/ci.ymlcomplete file
name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: [self-hosted, linux, docker]
    container: golang:1.27
    steps:
      - uses: spindle/checkout
      - run: go vet ./...
      - run: go test ./... -count=1

Quickstart

Two files, one runner, one check.

The workflow goes in the repository. The runner is a process you start once. The first push that carries the file triggers it — the workflow is read from the pushed commit.

1. Commit the workflow

Only .spindle/workflows/*.yml and *.yaml are read: one directory, no nesting, no fallback to another CI's directory. Each file is capped at 1 MiB. A file that does not parse creates no runs; its error is shown in the repository's Threads page while the other files keep running.

The file below is complete. It runs on every branch push and every pull request, inside a Go image, and reports the check threads/ci/test.

.spindle/workflows/ci.ymlvalid
name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
permissions:
  contents: read
jobs:
  test:
    runs-on: [self-hosted, linux, docker]
    container: golang:1.27
    steps:
      - uses: spindle/checkout
      - run: go test ./... -count=1

2. Start a runner

A host administrator mints a one-time registration token at /admin/runners, together with the runner's repository policy: every repository, or an allowlist of owner/name and owner/* patterns. On the runner host — Docker is required, and DOCKER_HOST names the daemon — exchange the token once and then serve:

shellrunner host
spindle --server https://git.example.com runner serve \
  --register wrg_… \
  --token-file /etc/spindle/runner.token \
  --labels self-hosted,linux,docker --name build-1 --capacity 1

# afterwards the token file is enough
spindle --server https://git.example.com runner serve \
  --token-file /etc/spindle/runner.token \
  --labels self-hosted,linux,docker --name build-1 --capacity 1

Labels are exact strings matched as a subset: a job's runs-on must be contained in the runner's declared set. The hosted Linux labels (ubuntu-latest and the dated variants) map onto self-hosted + linux before matching, so a migrated workflow keeps its spelling; the Windows and macOS labels stay unmapped on purpose. Capacity 1 keeps one job per daemon, which is the isolation-preserving shape for untrusted code. The runner declares and then long-polls; a claim is a compare-and-swap on the queue entry, so any number of runners need no coordinator, and fetching is the heartbeat. A label may carry Forgejo's name:docker://image spelling (ubuntu-latest:docker://node:lts) to supply the image when the workflow names no container.image; with no mapping, a stock label (node, go, …) resolves to a digest-pinned image (Stock toolchain labels); lxc:// and host backends are refused at declare time.

3. Watch it

The repository's Threads page lists runs, the per-file parse errors and the Run workflow control. One run page shows jobs, runs-on, the runner, the check context, step results, artifacts and a live log per job. The commit page shows the same checks in its Checks panel, and the JSON API and spindle threads verbs return the same state.

Key reference

Every key the parser accepts.

The parser is strict. An unknown key is a parse error for that file — never a silently ignored typo. run-name, defaults, strategy.max-parallel, expression-valued timeout-minutes, continue-on-error and cancel-in-progress, and runs-on/container.image substitution are accepted; paths: and typed reusable workflows (local, or SHA-pinned on this instance) are supported, with the limits named in the tables.

Top level

Top-level workflow keys
KeyTypeDefaultWhat it does
namestringfile stemDisplay name and the <workflow> segment of every check context.
onname, list or mapping—Triggers; a file with no on parses but never fires.
run-namestring with ${{ }}workflow nameThe run title in the run list, page and API; rendered once at creation from github.* and inputs.*, one bounded line.
envmap[string]stringemptyMerged under job and step env. Scalars are coerced to text; a nested value is an error.
defaults{run: {shell, working-directory}}noneShell and working directory every run step inherits; a job's block overrides per key and a step's own key wins. Both are literals.
concurrencyname or {group, cancel-in-progress}noneOne running and one pending run per group per repository. cancel-in-progress takes a literal boolean or one ${{ }} expression, resolved per cell at creation.
permissionsmapping or read-all/write-allinstance default (read)A closed vocabulary: contents, issues, pull-requests, deployments, packages, checks, statuses, id-token (plus read-all/write-all). Any other scope is a named parse error (the scope matrix).
enable-openid-connectboolfalseThe Forgejo spelling of the OIDC grant; the same grant as permissions: id-token: write.
jobsmap[string]jobrequiredAt least one job.

Triggers

Supported triggers and filters
TriggerKeysFires when
pushbranches, branches-ignore, tags, tags-ignore, paths, paths-ignoreA branch push matching branches or a tag push matching tags, and — when declared — a changed-file set matching paths. The ref filters are independent: a tags-only trigger never matches a branch push, and a branches-only trigger never matches a tag.
pull_requestbranches, branches-ignore, paths, paths-ignore, typesAny emitted lifecycle action on a PR targeting a matching branch whose changed files match; no types means every emitted action. The vocabulary is closed to opened, synchronize, reopened, closed (including a merge), edited, ready_for_review, converted_to_draft, labeled, unlabeled, assigned, unassigned, milestoned, demilestoned; anything the service never emits is a parse error.
pull_request_targetsame as pull_requestThe same PR edges, but the base branch's file runs with base secrets and a write token. Off per repository by default; enabling it is a maintainer switch, and a declarative head checkout needs a second switch (both audited).
repository_dispatchtypesPOST …/api/threads/dispatches with the write role. event_type selects a type; client_payload is a bounded object read as github.event.client_payload.*. Runs the default branch.
workflow_runworkflows, types, branches, branches-ignoreAnother workflow's run edge, matched by upstream workflow name and head branch; omitted types means completed. An untrusted upstream holds the follow-up for approval.
merge_grouptypes (checks_requested), branches, branches-ignoreA push to a merge-queue ref (refs/heads/gh-readonly-queue/<base>/pr-<n>-<sha>); the run checks the queue head with the base branch's file (Merge queue).
create / deletenoneA branch or tag created or deleted by a push (ref and ref_type in the payload). A job-token push starts nothing.
deployment / deployment_statusnoneA deployment record is created, or changes state (pending, in_progress, failure).
releasetypesA release lifecycle action: created, published, edited, deleted, prereleased, released, unpublished.
issuestypesopened, edited, closed, reopened, labeled, unlabeled, assigned, unassigned, milestoned, demilestoned.
issue_commenttypescreated only; comment editing and deletion are not implemented.
pull_request_reviewtypes (submitted, dismissed)A review submitted or dismissed by the review service. The run uses the PR's merge ref and the same fork trust rule as pull_request.
pull_request_review_commenttypes (created)A new inline review thread or reply, including the threads a review opens on submission.
labeltypes (created, edited, deleted)A label definition changed by triage — not the labeled PR/issue metadata edge.
milestonetypes (created, opened, closed, edited, deleted)A milestone definition changed; a state flip is opened/closed and any other field edit is edited.
forknoneA fork completed on the original repository, default branch; the payload carries forkee.
watchnone (action: started)A first star; a repeat star or an unstar emits nothing.
check_runtypes (created, completed)An external CI report on the checks surface. Threads' own mirrored check is the run itself and never re-fires this trigger.
workflow_dispatchinputsA manual dispatch from the UI, API or CLI. Input types: string, boolean, choice, number, environment.
workflow_callinputs, secrets, outputsA reusable workflow's typed interface (the callee side). The key never starts a run by itself.
schedule- cron: "…", optional timezone:The maintainer's sweep, on the default branch only. Five fields; names, @daily-family macros, L/NW/# and a per-entry timezone are supported.

status, check_suite, registry_package, gollum, page_build, branch_protection_rule, public, discussion and discussion_comment are named parse errors: this engine has no emitter for them, and a trigger that can never fire is not accepted. pull_request_review_thread is also refused, because resolving an inline thread is not a separate event here. merge_group is accepted: a push to the documented queue ref starts exactly one run, and the Merge queue is the product surface that creates those refs, gates on the run and lands the entry.

Job

Job keys
KeyTypeDefaultWhat it does
runs-onlabel or listrequiredThe runner must declare every label, case-insensitive and exact. No wildcards. A label may be a ${{ matrix.* }}, ${{ strategy.* }}, ${{ inputs.* }} or ${{ spindle.* }} span — one of the two structural fields a matrix may vary, with container.image — expanded per cell before the job is written.
defaults{run: {shell, working-directory}}workflow defaultsThis job's run-step defaults; a step's own key still wins.
containerimage or mappingrunner --imageimage, env, options, ports, command and entrypoint are applied. ports publishes each container port on an ephemeral loopback address (a fixed host port is refused); entrypoint/command own the container's process, and an early exit is a named failure. volumes need the runner's --container-valid-volume allowlist, and credentials is refused by name — the pull identity is the runner's, never a workflow password (D-23).
servicesmap[id]servicenoneSidecars on the job network, reachable at their id (the container port). credentials is refused by name: the pull identity is the runner's.
needsone job key, or a listnoneneeds: test and needs: [test] are identical. Must exist and be acyclic. A matrix dependency waits for every cell.
ifexpressionsuccess() over needsDecided by the server before the job is claimable. False means skipped. It may read secrets.* and vars.*; an untrusted run reads an empty secrets map, and no value reaches the reason or the log.
strategy.matrixaxes plus include/excludenoneProduct of scalar axes with GitHub's merge rules; an include-only matrix is one cell per entry; 256 cells max.
strategy.fail-fastbooltrueA failed cell cancels its siblings.
strategy.max-parallelint (1…256)no per-matrix boundHow many cells of this matrix run at once; cells are admitted in expansion order and the rest wait queued. Refused without a matrix.
outputsmap[name]templatenoneValues a dependent reads as needs.<job>.outputs.<name>.
environmentname or {name, url}noneA deployment target with reviewers, a wait timer, a branch/tag allowlist and its own secrets and variables. Takes a literal name; a ${{ }} span here is a parse error. Deployments to one environment serialize in a single visible slot (Deployments).
timeout-minutesint or one ${{ }} expression360Cancels the job and removes its containers; the conclusion reads timed_out, distinct from an operator cancelled. The expression resolves per cell from github.*, matrix.*, strategy.* and inputs.* and must be 1…360.
continue-on-errorbool or one ${{ }} expressionfalseGitHub semantics: the job stays a failure, but the run conclusion follows the other jobs; dependents run and needs.<job>.result reads success. One expression is resolved per matrix cell at creation.
permissionsmapping or shorthandworkflow defaultThe closed scope vocabulary; job-level wins.
enable-openid-connectboolworkflow defaultThe job-level OIDC grant; an explicit id-token: none wins.
uses/with/secretsstring/map/map—Call a reusable workflow: ./.spindle/workflows/name.yml, or owner/repo/.spindle/workflows/name.yml@<40-hex sha> when the callee is publicly readable. The callee must declare on.workflow_call; its typed inputs, secrets and outputs are the call's interface. Cross-repository calls take explicit secrets only (inherit is refused there) and are audited.

Step

Step keys
KeyTypeDefaultWhat it does
ididentifier—Letters, digits, _, -; not starting with a digit; unique in the job. Required to publish outputs.
runstring—Exactly one of run and uses.
usesaction—A built-in, a local action (./…), docker://image, or a remote owner/repo[/path]@ref / full URL when the instance's action policy admits it (Action policy).
withmap[string]string—Action inputs. An undeclared key fails the step.
shellbash, sh, python, python3, pwsh, cmd, or a <cmd> {0} templatebashA run step with no shell: uses bash --noprofile --norc -eo pipefail -c, the familiar Linux default; on an image without bash it falls back to sh -e -c and says so. sh is sh -e -c; a custom template is split into argv with {0} replaced by a script file.
working-directorypathworkspaceRelative joins the workspace; absolute wins.
envmap[string]stringemptyOverrides job and container env.
ifexpressionsuccess()The small documented subset. An unsupported expression fails the step, never skips it.
continue-on-errorboolfalseThe step may fail without failing the job; its result is still a failure.
timeout-minutesint or one ${{ }} expressionremaining job timeOn expiry the step's container, or a background step's process group, is killed and the step reports timed_out. The expression resolves from github.*, matrix.* and inputs.*.
backgroundboolfalseStart the step asynchronously in its own session and process group; needs an id. Only on a run, docker:// or local docker action.
wait / wait-allbackground id or all / bool—Join one or every outstanding background step; the wait fails if that step failed.
cancelbackground id or all—Terminate the step's process group (SIGTERM, then SIGKILL). The job end kills every remaining background on every path.
parallellist of steps—Run the members concurrently as one unit, reported in declaration order; the group shares the workspace.

A step with both run and uses, or neither, is a parse error. A failed step skips the rest of the job unless it opted into continue-on-error.

Substitution

A ${{ … }} span is validated at parse time against a closed vocabulary and expanded at run time. Only the following sites are substituted — anywhere else, the span is a parse error, never literal text that reaches a shell.

Where substitution applies and what resolves
Sitematrix.*, inputs.*steps/needs outputs
step name, run, if, shell, working-directoryyesyes
step env and with valuesyesyes
a job's outputs valuesyesyes (steps of the same job, needs dependencies)
runs-on labels, job/step timeout-minutes, job continue-on-error, concurrency.cancel-in-progressyes (per cell)no
run-nameinputs.* onlyno
concurrency group and a job nameyesno (computed before any step runs)
container.imageyes (per cell — one of the two structural exceptions)no
workflow/job/container/service env, services.*.image, environment, defaults.run.*nono

Every step site above reads spindle.* — the canonical run context — and its value-identical github.*/forgejo.*/forge.* aliases: one closed field set and one availability table, so an imported file cannot change meaning. It also reads the bounded github.event.* payload, runner.*, vars.* (environment over repository over organization, sealed and masked), env.* and secrets.*. A step field and a step if: additionally read strategy.* — job-index (zero-based), job-total, fail-fast and max-parallel describe the matrix cell, and a plain job has an empty strategy context — and job.status, the running job's status (success, failure, cancelled; a failure tolerated by continue-on-error still reads success). Inside a composite action's own steps, github.action_path is that action's directory, per nesting level; a workflow step, a job if: or an output template that reads it is a parse error. A job name and a job-level concurrency group read github.*, inputs.* and, per cell, matrix.* and strategy.* — not env.*, secrets.*, runner.*, vars.*, job.* or outputs (a workflow-level group reads github.* and inputs.* only: no cell exists yet). The rule for a missing value has two halves:

  • An absent supported value expands empty: an unset env.NAME, a secret the run does not have (a fork run, a typo), github.actor on a run with no actor, or server_url/api_url with no canonical origin.
  • An undeclared output is an error: a steps.<id>.outputs.<name> or needs.<job>.outputs.<name> naming an unknown step/job or an output that was never published fails the step and names the reference.

Each site also has a fixed context availability set, checked at parse time and again at evaluation. A step field or a step if: reads every context above; a job if: reads github, vars, matrix, inputs, env, secrets and needs (no runner, no steps, no strategy, no job) — vars.* and secrets.* included, because the server resolves them when it decides eligibility, with an empty secrets map on an untrusted run; a job name reads github, vars, matrix, strategy, inputs; a runs-on label and a timeout-minutes read github, matrix, strategy, inputs; run-name and a reusable caller's with: read github and inputs. A reference outside its site's set is a named error, never an empty value.

Expansion is one pass, so a substituted value is data, never a template: a secret whose body contains ${{ github.ref }} stays exactly that text. Secrets are masked in the log.

Triggers

Twenty-three events, filtered by ref and path.

Filters use the documented Actions glob dialect — *, **, ?, + and an ordered ! — and paths narrows a run to the changed files. A push carries one kind of ref, so the two push filters are independent — a tags-only workflow never runs on a branch, and a branches-only workflow never runs on a tag. The default-branch events each read their workflow from the default branch (a pull_request_target reads the base tip) and name their own trust rule.

Push. branches matches branch pushes (refs/heads/<branch>) and tags matches tag pushes (refs/tags/<tag>) by exact name or pattern: * stops at /, ** crosses it, and ! negates in order. branches-ignore/tags-ignore are the exclusion spelling (naming both an include list and its ignore twin is a parse error). Naming neither ref filter fires on both kinds. paths/paths-ignore additionally select by the changed-file set — a push diffs its pre-image, and a path-filtered trigger never fires when no diff can be computed (fail closed). A merged pull request creates a push run for the base branch. A push authenticated by a job token creates nothing, branches and tags alike.

Tag runs. A landed tag starts a run; the tag name selects the tags globs. The run has no branch: github.ref is the full refs/tags/v1.2.3, github.ref_name is v1.2.3, and github.event_name stays push. A branch and a tag of the same short name are independent runs — one never cancels the other (Operations). A tag delete and a notes ref create nothing.

Pull request. branches filters the target and paths the merge-base diff. types is a closed vocabulary of what the pulls service emits: opened, synchronize, reopened, closed (including a merge), edited, ready_for_review, converted_to_draft, labeled, unlabeled, assigned, unassigned, milestoned, demilestoned. Omit types to fire on every emitted action. A same-repository PR runs the head commit's file, trusted, with secrets. A fork PR runs the base branch's file, untrusted, with no secrets and a read-only token, unless the repository opted in to send_write_tokens (maintain+, audited): then the fork token carries the scopes the file declares, still never secrets and never id-token.

Merge refs. Every pull request edge — the code edges (opened, synchronize, reopened, closed, edited, ready_for_review, converted_to_draft) and the metadata-only edges (labeled/unlabeled, assigned/unassigned, milestoned/demilestoned) — pins the server-computed merge commit of base and head, with refs/pull/<n>/merge as the run's ref and ${{ github.ref }}, with SPINDLE_SHA (alias GITHUB_SHA) and the check's commit reading the merge commit — so a failure that only exists after the merge goes red. The job's SPINDLE_REF variable (alias GITHUB_REF) keeps the base branch, which is the documented job identity. If the merge conflicts, or the git reader cannot build one, the run falls back to the head commit and refs/pull/<n>/head and says so in the log. The workflow file is still the head's (same repository) or the base's (fork), never the contributor's file for a fork.

pull_request_target. The same edges, but the base branch's file runs with base secrets and a write token. It is off by default per repository; a maintainer enables it on the Threads page and the change is audited. Inside it, an spindle/checkout naming a ref or another repository fails at plan time unless a second, separately audited switch (pr_target_allow_head_checkout) is on. A run: step can still fetch the head itself; that residual is why the default is off.

Repository dispatch. POST …/api/threads/dispatches with {"event_type":"deploy","client_payload":{…}} and the write role. The event type selects types; the payload is an object of at most 10 top-level keys, nesting at most 4 levels, 64 KiB encoded, exposed as github.event.client_payload.*. It runs the default branch only, and the answer is 202 {"runs":[…]}.

Following another run. workflow_run matches upstream workflow names (not globs), the upstream head branch, and requested or completed (completed when omitted). Its file comes from the default branch, and a chain stops at depth 3. An untrusted upstream (a fork PR) holds the follow-up at pending_approval until a maintainer approves; while that hold is pending, a cross-run artifact read is refused with 409 naming the parent run.

Repository and deployment events. create/delete fire for a branch or tag created/deleted by a push, with ref and ref_type in the payload. deployment fires when a job's deployment record is created; deployment_status when it is decided (pending, in_progress, failure). Both read the default branch's file, and a push authenticated by a job token starts none of them.

Release and issues. release fires on created/published/edited/deleted/ prereleased/released/unpublished; issues on its emitted lifecycle actions; and issue_comment on created. These runs read the workflow from the default branch tip, never from the tag or the commenter, and a release run still reports the tag's commit.

Review, definition, fork, star and check-run events. pull_request_review (submitted, dismissed) and pull_request_review_comment (created) come from the review service; they run from the PR's merge ref with the same fork trust rule as a pull_request, so a fork PR's review run is untrusted and reads the base workflow file. label and milestone are definition events from triage — a label created/edited/deleted, a milestone created/opened/closed/edited/deleted — not the labeled/milestoned metadata edges, and they run the default branch's file. fork fires on the original repository after the fork task commits, watch on a first star, and check_run (created, completed) only for an external CI report — Threads' own mirrored check is the run itself, so a workflow cannot trigger a copy of itself.

Dispatch. Typed inputs from the UI, the API (POST …/api/threads) or spindle threads run (with repeatable --input k=v). Types are string, boolean, choice, number and environment; inputs must match the declared schema or the call is 422.

Schedule. Five fields, UTC unless the entry sets a timezone:. Supported: *, numbers, ranges, steps (*/15, a-b/N), comma lists, JAN-DEC/SUN-SAT, the @daily-family macros, L/NW/#, and DL. A six-field expression or an invalid timezone is a parse error. Each entry can be disabled or enabled without a commit, and run now fires it manually — even while disabled; a backlog of missed ticks coalesces to one run and reports the count instead of replaying (Operations).

manual dispatch with typed inputsvalid
name: Deploy
on:
  workflow_dispatch:
    inputs:
      environment:
        description: target environment
        type: choice
        options: [staging, production]
        required: true
        default: staging
      dry_run:
        description: skip the deploy
        type: boolean
        default: false
jobs:
  deploy:
    runs-on: linux
    environment: production
    steps:
      - uses: spindle/checkout
      - name: deploy
        if: inputs.dry_run != 'true'
        run: ./deploy.sh --target "${{ inputs.environment }}"

Structural fields are literals except two, which take one per-cell expression: runs-on and container.image. environment, services.*.image, defaults.run.* and the workflow/job/container env layers are literal — a dispatch input can choose the environment name only if the job names it literally.

Jobs

Dependencies, matrices, one lock.

A job with no if runs only when every dependency succeeded. Failures propagate as skipped, never as a silent green. A matrix is the product of its axes plus include/exclude. A concurrency group admits one run at a time.

needs, matrix and concurrencyvalid
name: Build
on:
  push:
    branches: [main]
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true
jobs:
  test:
    runs-on: linux
    container: golang:1.27
    strategy:
      fail-fast: false
      matrix:
        go: ["1.26", "1.27"]
    steps:
      - uses: spindle/checkout
      - run: go test ./...
        env:
          GO_VERSION: ${{ matrix.go }}
  package:
    needs: [test]
    runs-on: linux
    steps:
      - run: echo "only after every test cell"
  notify:
    needs: [test, package]
    if: failure()
    runs-on: linux
    steps:
      - run: echo "something above failed"

Propagation. A failed, cancelled or skipped dependency skips its dependents and records the reason. A true if runs anyway: always(), failure() or needs.test.result == 'failure'. if: false disables a job without deleting it.

Matrix. Product of the non-empty scalar axes, expanded in alphabetical axis order, values in declaration order. exclude removes a base cell that matches every pair of an entry; include merges into every surviving base cell it does not conflict with, and an entry that fits none becomes a cell of its own — so an include-only matrix is one cell per entry. Every cell gets its own job id, check context and MATRIX_<AXIS> variable. The result is capped at 256.

Fail-fast. On by default: a failed cell cancels its siblings. A job-level continue-on-error: true suppresses that, because the failure is tolerated: the job stays a failure, the run follows the other jobs, and dependents run with needs.<job>.result reading success.

Concurrency. One running and one pending run per group per repository, GitHub's rule. A newer run replaces the pending one (never a queue of stale commits); cancel-in-progress: true — or one ${{ }} expression that resolves to true per cell — cancels the holder as soon as the new run is created. A workflow-level group belongs to the run, so sibling jobs do not serialize each other, and the run header names the group it waits for (pending_group) instead of showing a silent spinner. A group that cannot resolve is a parse error or a 422 — never a literal fallback.

The expression language

One evaluator serves every if: and every ${{ … }} site. It reads success(), failure(), always(), cancelled(), startsWith, endsWith, contains, format, join, toJSON, fromJSON and hashFiles; spindle.* — the canonical context — and its value-identical github.*/forgejo.*/forge.* aliases, github.event.*, runner.*, vars.*, matrix.*, strategy.*, job.* (the last two only at their documented sites, above), inputs.*, env.*, secrets.*, and steps.*/needs.* outcomes, conclusions and outputs.

The operators are !, ==/!=, ordered < <= > >= (numeric when both sides are numbers, text otherwise), value-returning &&/|| and parentheses. [ ] indexes a context (github['sha'], steps['build'].outputs['name']), and needs.*.result, steps.*.outcome and their output forms are list filters. && and || return an operand, so github.ref == 'refs/heads/main' && 'prod' || 'dev' renders a value.

hashFiles('**/go.sum') runs in the job container against the workspace (glob dialect, leading ! excludes, sorted deterministic hashing); it is available in step sites and job outputs, and a named refusal in a job if:. No match is the empty string; a walk over 1000 files or 100 MiB is a named error. toJSON(value) renders deterministic JSON (sorted keys, no HTML escaping) for any value, a bare context included; fromJSON(string) parses a JSON document (invalid JSON is a named error) and a parsed object/array is indexed with .key/['key']/[0].

A job if: adds needs.<job>.result and needs.<job>.outputs.* and may read secrets.*/vars.* (empty on an untrusted run). An unsupported function or expression is a parse or evaluation error naming it — never a silently skipped job. case(...) is not a function in this language, so it stays a named parse error.

Execution surface

One container, one workspace, your services.

Every job gets exactly one container and one workspace volume. Steps are docker exec invocations inside it, so the toolchain and network namespace persist. Services are sidecars on that job's network.

Image. container: names it; without one the runner's --image is used (default alpine/git, which carries git for checkout). A stock toolchain label (ubuntu-latest, node, python, go, rust, docker) resolves to a digest-pinned upstream image when neither the workflow nor the runner declares one — see Stock toolchain labels. The image must provide what your steps call — a distroless or scratch image has no shell.

Workspace. A per-job volume at /spindle/workspace. The runner mounts nothing else. Workflow-supplied volumes are refused: a bind mount is host filesystem access.

Services. Each entry is one sidecar, reachable at its key on the container port: postgres:5432, never a host port. The runner waits for a declared port or the image's own HEALTHCHECK; 60 seconds without readiness fails the job naming the service. A workflow can gate on the service's own readiness probe with docker's --health-cmd, --health-interval, --health-timeout, --health-retries and --health-start-period flags (they run inside the service container); a malformed probe is refused before the container is created. A registry credentials: block is refused by name: the pull identity is the runner's (its daemon config, an image mirror, or --registry-auth-file) and the password is piped on stdin, never argv or a log line.

Environment. Lowest to highest: runner built-ins, workflow env, job env, container env, step env, then secrets by name. Spindle’s names are canonical: scripts read $SPINDLE_SHA, $SPINDLE_REF (the tag on a tag run), $SPINDLE_REF_NAME, $SPINDLE_WORKSPACE, $SPINDLE_SERVER_URL, $SPINDLE_API_URL and the rest, and $SPINDLE_EVENT_PATH names the bounded event payload; $SPINDLE_RUNNER_OS, $SPINDLE_RUNNER_ARCH, $SPINDLE_RUNNER_NAME and $SPINDLE_RUNNER_TEMP describe the runner. $SPINDLE_STEP_SUMMARY collects markdown for the run page; $SPINDLE_STATE is a JavaScript action’s pre→post hand-off (the pre hook’s NAME=VALUE lines reach the post hook as STATE_<name>; a run step has no post phase, so the file is not exposed there). $SPINDLE_JOB_TOKEN is the scoped job token. A step may write later steps’ variables through $SPINDLE_ENV and prepend to PATH through $SPINDLE_PATH; protected names are refused by name.

GitHub and Forgejo names are migration aliases only. Every built-in variable has a value-identical GITHUB_* twin (and a FORGEJO_* one where Forgejo has it), so a workflow imported from GitHub or Forgejo runs unchanged; new workflows and this documentation use the Spindle name.

Checkout. uses: spindle/checkout runs inside the container and clones the run's exact commit with the job token, shallow unless fetch-depth: 0. fetch-tags: true, ref: and path: are supported; any other input is refused by name. Any job that pushes needs the full clone. The clone URL must be reachable from inside the container.

a database service and sized containervalid
name: integration
on: push
jobs:
  test:
    runs-on: [self-hosted, linux, docker]
    container:
      image: golang:1.27
      options: "--cpus 2 --memory 2g --shm-size 512m"
    services:
      postgres:
        image: postgres:17
        env:
          POSTGRES_PASSWORD: ci
          POSTGRES_DB: test
        ports:
          - "5432"
    steps:
      - uses: spindle/checkout
      - name: test
        env:
          PGHOST: postgres
          PGUSER: postgres
          PGPASSWORD: ci
        run: go test ./...

The options allowlist is small: --cpus, --memory, --memory-swap, --shm-size, --ulimit nofile=…, --init, --read-only, --user, --workdir, and docker's in-container --health-* flags. --cap-add, --device, --security-opt, --tty, every namespace flag and every mount are refused by default, at run creation and again at plan time. The workflow-owned process keys (entrypoint, command, ports) are separate declared fields, not free-form options.

Runner grants are the operator's. A workflow never widens its own isolation. Three knobs let a runner operator admit shapes for every job it takes: --container-privileged (admits --privileged and --cap-add), --container-valid-volume <glob> (admits a volume whose absolute host source matches), and --container-network (a user-defined network; host, none and namespace modes are refused). A grantable shape on a runner that did not opt in fails at plan time, naming the missing flag. A fourth, --docker-host, gives the job a docker endpoint (below). Every container grant — privilege, docker endpoint, shared network, volume allowlist — refuses --allow-fork-runs, so an untrusted PR can never reach a widened runner.

No Docker socket. A job container gets no socket and no daemon by default, so docker build exits 127 with the daemonless remedy in the message. Build with kaniko (no privileges, no socket) or buildah on a host whose kernel allows user namespaces — the image is the workflow's choice, the capability is the host's. A runner whose operator passed --docker-host exposes an endpoint to the job container only; that job is root-equivalent on the runner, and such a runner never accepts fork runs.

Steps & actions

Built-ins, local and remote actions, images.

No public marketplace to trust blindly. uses: resolves to the built-ins, a repository-local action, a container image, or a remote action the instance's policy admits — resolved, pinned to a commit and a content digest, embedded in the job, and recorded. The built-ins are Spindle's own, so spindle/<action> is the canonical spelling and actions/<action> is a migration alias. The setup helpers map their cache half onto the built-in spindle/cache.

Accepted uses spellings
Spindle (canonical)GitHub aliasWhat happens
spindle/checkoutactions/checkoutBuilt-in checkout inside the job container. A @v4 suffix on either spelling is accepted and ignored.
spindle/upload-artifactactions/upload-artifactUpload files from the job container to the run. v4 inputs are supported; see Artifacts.
spindle/download-artifactactions/download-artifactDownload an artifact of the same run — or, with a maintainer approval, another run of the same repository.
spindle/cache (/restore, /save)actions/cache (/restore, /save)Restore now and save at the end of a green job; the split forms restore-only / save-now. See Cache.
./.spindle/actions/<name>sameA repository-local action, resolved at run creation from the run commit (composite or docker).
docker://image[:tag|@sha256:…]sameRun the image as its own container on the job network, with the workspace volume.
owner/repo[/path]@ref or https://host/…@refsameA remote action: resolved under the instance policy, pinned to a commit and a content digest, embedded in the job and recorded on the run header (Action policy).
actions/setup-node, setup-go, setup-python— (marketplace)The remote action when policy admits it, with its cache: input rewritten around the built-in spindle/cache pair; otherwise refused by name with the exact recipe.
anything elseRefused by name, listing the supported spellings (Spindle's first) — never a silently different action.

Composite actions. runs.steps expand in place; each run step must name shell:; in a local action an inner uses may only be another local action or docker:// (a fetched remote composite may nest another remote action). The caller's with: values become INPUT_<NAME> environment variables and ${{ inputs.* }} fields; an undeclared input is a named refusal. ${{ github.action_path }} is the innermost action's own directory, per level. Nesting is capped at 10 and cycles are refused.

docker:// steps. The image runs as its own container, gets the step environment and INPUT_*, and never the job token or a repository secret. Its $SPINDLE_OUTPUT is copied out and published under the calling step's id.

Outputs. echo "name=value" >> "$SPINDLE_OUTPUT" (or a heredoc: name<<EOF … EOF). Caps: 50 per step, 100 per job, 64 KiB per value. A malformed line, an unterminated heredoc, an empty or over-long delimiter, or a reference to an output that was never published fails the step naming it — never a dropped value.

Summaries and commands. Append markdown to $SPINDLE_STEP_SUMMARY (1 MiB per step, 20 per job, 4 MiB joined) and the run page renders it through the sanitizing markdown renderer. Output lines of the form ::error::/::warning::/::notice:: become annotations (with file, line and title), ::group::/::endgroup:: fold the log, ::add-mask:: extends the mask, ::stop-commands:: suspends parsing, ::set-output:: joins the output namespace, and ::debug:: prints one debug line. An unknown command is a visible warning, not a silent drop.

a local composite action in usevalid
name: build
on: push
jobs:
  build:
    runs-on: linux
    steps:
      - uses: spindle/checkout
      - id: tools
        uses: ./.spindle/actions/tools
        with:
          version: "2.0"
      - run: |
          "${{ steps.tools.outputs.bin }}" --version
      - uses: docker://alpine:3.20
        with:
          who: world

spindle/cache is built in and scoped to the run's trust class (Cache). Artifacts move files between jobs of one run; another run of the same repository is readable only behind the cross-run approval (Artifacts).

Remote actions: resolved, pinned, allowlisted.

A remote reference is default-deny. The server resolves it at run creation, refuses anything the policy does not admit, and otherwise pins the ref to a commit and hashes the action's files before embedding them in the job payload. The runner never reads a repository or the network for an action. The run header records action_loads (source, ref, commit, digest) and the same facts land in the log.

Execution forms: a composite expands like a local one, including ${{ inputs.* }}, github.action_path and nested remote uses: (depth 10, cycles refused); a JavaScript action (using: node20/node24) runs on the job image's Node and names a declared minimum — a missing or too-old runtime is a named failure, never a skip; a docker action runs a registry image or builds its Dockerfile on the runner host, and the job container still gets no docker socket.

No implicit credential: a remote action receives its declared inputs and INPUT_*, never the job token or a repository secret. Changing the bytes under a pinned commit is a refusal. Revocation is removing the allowlist entry — the next run refuses the reference by name, quoting the allowlist key and both remedies.

spindle.tomlinstance policy
[threads.actions]
mode = "allowlist"       # deny | allowlist | open
allow = ["acme/*"]       # owner/repo, owner/*, or host/owner/repo
require_sha = true       # outside the allowlist: a full 40-hex commit
source = ""              # empty = this instance; else one https source
max_bytes = "16MiB"      # bounded fetch per action

The three modes: deny refuses every remote action (an air-gapped instance); allowlist (the default) permits a mutable tag or branch only for an approved repository and requires a full commit SHA everywhere else; open accepts mutable refs anywhere — an explicit operator weakening. Every mode still pins the commit, hashes the content and records both.

Reusable workflows: a typed interface.

caller and calleevalid
# .spindle/workflows/ci.yml
jobs:
  deploy:
    uses: ./.spindle/workflows/deploy.yml
    with:
      target: production
    secrets:
      REGISTRY_TOKEN: ${{ secrets.REGISTRY_SECRET }}
  smoke:
    needs: [deploy]
    runs-on: linux
    steps:
      - run: curl "${{ needs.deploy.outputs.url }}"

A job can call another workflow instead of declaring steps. The callee declares on.workflow_call: typed inputs (string, boolean, number, with required/default), declared secrets and outputs templates. Its jobs join the same run as deploy / release, with their own checks and logs.

with: is expanded once at run creation from github.* and the caller's inputs.*; an unknown input, a missing required one, or a value that does not parse as its declared type is a named refusal. secrets: is an explicit callee: ${{ secrets.SOURCE }} map or inherit; a same-repository callee with no block gets the repository's secrets, and a cross-repository callee gets none by default. inherit never crosses a repository boundary. permissions: is downgrade-only.

Cross-repository calls are owner/repo/.spindle/workflows/x.yml@<40-hex sha>: public on this instance, a full commit (never a branch or tag), explicit secrets only, and each call writes an audit record naming caller, callee and commit. Nesting is capped at 4 levels and a cycle is refused. Not supported, each a named refusal: a matrix caller, environment secrets inherited by a callee, and a needs. reference to a nested call's job.

Background and parallel steps.

a dev server and two lintersvalid
steps:
  - id: server
    run: ./bin/dev-server
    background: true
  - run: ./bin/smoke
  - cancel: server
  - name: linters
    parallel:
      - run: ./bin/lint-go
      - run: ./bin/lint-web

background: true starts a step asynchronously while later steps run; wait: <id> (or wait-all: true) joins it and fails when it failed, cancel: <id> terminates it, and the job end kills every remaining background on every conclusion. Each runs in its own session and process group inside the job container (setsid must be in the image), so a kill reaches every child; the runner verifies none survived and fails the job rather than leaking it.

parallel: runs its members concurrently and reports them in declaration order. They share the workspace, so two members writing one file race. A member failure fails the group unless that member has continue-on-error. A background step needs an id; wait, wait-all and cancel are control keys, mutually exclusive, and are refused inside composite actions.

Secrets & permissions

Secrets are environment variables.

A secret — organization, repository or environment scoped — is injected under its own name into every step of a trusted run, the tightest scope winning. ${{ secrets.NAME }} is substituted too, and a whole-value env: entry is delivered by name so the value never reaches argv. The job token is automatic, short-lived and scoped to one attempt.

a secret and the job tokenvalid
name: push a build branch
on:
  push:
    branches: [main]
permissions:
  contents: write
jobs:
  publish:
    runs-on: linux
    steps:
      - uses: spindle/checkout
        with:
          fetch-depth: 0
      - name: push
        run: |
          git config user.name ci
          git config user.email ci@example.com
          date > build.txt
          git add build.txt
          git commit -q -m "ci: build"
          git push origin HEAD:refs/heads/ci-output

Writing. Settings → Secrets, or PUT …/api/threads/secrets/{name}. Write-only: the API returns names and timestamps, never a value. Names match [A-Za-z_][A-Za-z0-9_]{0,63}; values are 1 B – 64 KiB.

Reading. The value is an ordinary environment variable. ${{ secrets.NAME }} also works — as the whole value of an env: entry it is delivered by name, embedded in a script it is spliced and masked. Guard it: ${TOKEN:?TOKEN is not set} turns a missing secret into a clear failure instead of an empty string.

Scopes and precedence. A secret lives at one of three scopes, and the tightest wins: environment > repository > organization. Organization secrets are managed in Settings → Secrets on the organization page (owner only) or /api/v1/orgs/{org}/threads/secrets; each carries a repository policy — visibility: "all" (the default) or "selected" with a list — and an unselected repository gets nothing, not even the name. The supplying scope is recorded on the job as secret_scopes (name → organization/repository/environment), so the run page says where a credential came from and never what it was. There is deliberately no user scope (D-22): a run executes as the repository, not as a person, so a per-user credential would be readable by any workflow in it. Variables (vars.*) follow the same order.

Masking. Best effort, one rule shared by the server and the runner: a value of 4+ bytes is replaced wherever it appears (longest first); a multi-line value is masked whole and line by line; a value shorter than 4 bytes only as a whole token. The server re-masks every stored frame and step result, so an older runner cannot write a value into the bucket. Encoded, split or derived values still print. Never write a secret into an output or an artifact — both are data, not logs.

Fork runs. No secrets at all. The payload carries an empty set; a fork can never opt in by editing the file. A repository may opt in to send_write_tokens (maintain+, audited) so the fork run's token carries the scopes its file declares — never secrets and never an id-token, and the run page records the decision.

The job token. $SPINDLE_JOB_TOKEN always reads its own repository; $GITHUB_TOKEN and $FORGEJO_TOKEN carry the same value as migration aliases, and an authored env: value of any of those names wins. permissions: is a closed vocabulary — contents, issues, pull-requests, deployments, packages, checks, statuses, id-token (plus read-all/write-all) — and it is also the token's platform-API authority: a read scope is the read role, issues: write is triage, contents: write or pull-requests: write is write, and deployments: write creates deployment records and their statuses for the run's repository (never the Threads operator surface). contents: write adds push. packages and checks/statuses are grants of their own, not implied by the repository role: the job token is exchanged at /v2/token for a short-lived registry token scoped to its own repository, and a check run needs checks: write (or statuses: write). Any other scope is a named parse error, never an accepted-and-inert key. A fork is pinned to read. A protected ref still refuses it, because the principal is ci:<runner>, not the user. A push with it starts no workflow, so a workflow cannot rebuild itself forever.

The scope matrix.

The supported set is exactly what the token can do. A scope this server cannot enforce is refused at parse time, by name, with the supported set in the error.

Job-token permission scopes
ScopeLevelsThe token may
contentsread / write / noneClone and fetch the run's repository; write also pushes to it.
issuesread / write / noneRead issues; write is the triage role — labels, assignment, closing others' issues, labels and milestones.
pull-requests (pull_requests accepted)read / write / noneRead pull requests; write is the write role — open/update PRs and create releases (releases still need contents: write).
deploymentsread / write / noneRead deployment records; write creates a deployment and appends its statuses for this repository. Never the Threads operator surface.
packagesread / write / noneThe OCI registry of this repository: read pulls, write also pushes. The job token is exchanged at /v2/token for a 5-minute, repository-scoped registry token; the job token itself is never a registry bearer credential.
checksread / write / noneRead check runs for this repository; write creates and updates them (the external-CI reporting path). Repository-scoped; it never manages CI tokens or admin state.
statusesread / write / noneGitHub's legacy commit-status name. There is one status/check-run surface here, so it grants exactly what checks grants.
id-tokenwrite / noneExchange for a short-lived OIDC ID token (Approvals). read is not a level.
read-all / write-allshorthandThe baseline for contents, issues and pull-requests only. It never grants id-token, deployments, packages, checks or statuses — name those.

Refused by name, with the reason: actions (the operator surface — dispatch, cancel/rerun, approve, environments/secrets), attestations, discussions, metadata, models, pages, repository-projects, security-events and wiki. A converted workflow drops a refused scope and names it in the report, so the file still parses.

Approvals and environments

A fork pull request from a first-time contributor is created pending_approval: jobs written, checks pending, nothing enqueued. A maintain or admin approves or denies on the run page (or POST …/api/threads/{run}/approve|deny). The gate applies when the actor has no previously merged PR in the repository; a same-repository PR is never gated. A workflow_run whose upstream run was untrusted is held the same way (approval_kind: workflow_run), and while that hold is pending a cross-run artifact read answers 409 naming the parent run. Nobody approves, nothing runs — there is no timeout.

An environment is a deployment target with up to six required reviewers (users or org/team, each needing write or more, checked when the environment is saved), a wait timer, prevent-self-review, a deployment branch/tag allowlist, its own secrets and its own non-secret variables. A job names one with environment: production; the run is created pending_approval, nothing is enqueued, and it starts only after every required reviewer (or a repo admin) approves and the timer elapses. A run from a ref outside the allowlist fails that deployment job by name. Environment secrets override repository and organization secrets of the same name, reach only a trusted run with an approved deployment, and never reach a fork run; environment variables resolve as ${{ vars.NAME }} and override repository and organization variables of the same name. A job naming an undefined environment fails that job. A pending deployment is visible in the run list (naming the environment), notifies its reviewers and can be cancelled by anyone with write access.

Deployments serialize per environment. One deployment holds the environment's slot; every later one is recorded queued with one visible reason naming the holder, and is promoted when the holder reaches a terminal state. The queue is bounded at 100 waiters. Settings → Environments shows the protection rules, the deployments and the secrets/variables; the API is the same state (Deployments).

OIDC. permissions: id-token: write — or Forgejo's enable-openid-connect: true — on a trusted run supplies SPINDLE_ID_TOKEN_REQUEST_URL and a request token. POST a required audience for a five-minute RS256 JWT; the claim set is closed (iss is server.public_url, sub is repo:owner/name:ref:<ref>, :environment:<name> for an environment job or :pull_request, plus ref_type, ref_protected, job_workflow_ref, runner_environment and the run identity). write-all deliberately does not grant it, and an explicit id-token: none denies it.

Deployment records, statuses and the API.

Every deployment — a job that named environment:, or an external CI calling the API — is one record with its environment, ref, sha, creator, producing run/job, latest state and a bounded status history. States are queued, pending, in_progress, success, failure, error and inactive; a transition appends to the history and a terminal state releases the environment slot.

Deployment API
Method and pathWhat it does
GET …/api/threads/deploymentsList newest-first; environment, after and n (max 200) page it.
POST …/api/threads/deploymentsCreate a record for an environment; the ref must pass that environment's branch/tag policy.
GET …/api/threads/deployments/{id}One record with its status history, queue position and reason.
POST …/api/threads/deployments/{id}/statusesAppend in_progress/success/failure/error/inactive.

Authorization is the boundary: a repository write role may create, status and read. A job token is accepted only for its own repository and only with the deployments scope (write to create/status, read to list/get) — a contents: write token is refused, and it never reaches the Threads operator surface. An API deployment cannot move to in_progress until the environment slot promotes it.

Artifacts, cache, schedules, retention

Files between runs; a clock that fires once.

upload in one job, download in the nextvalid
name: artifacts
on: push
jobs:
  build:
    runs-on: linux
    steps:
      - uses: spindle/checkout
      - run: make dist
      - uses: spindle/upload-artifact
        with:
          name: build-out
          path: |
            dist
            coverage/*.out
          if-no-files-found: error
          retention-days: 7
  verify:
    needs: [build]
    runs-on: linux
    steps:
      - uses: spindle/download-artifact
        with:
          name: build-out
          path: dist
      - run: ./scripts/verify-release.sh dist

Artifacts. Names are unique per run (letters, digits, ., _, -; up to 255 bytes). Paths are workspace-relative: exact file, directory, */? within a segment, ** across segments, or .. Only regular files; symlinks are not followed. The image needs find and tar. Caps: 256 MiB per file, 2 GiB per run, 1000 files per artifact.

v4 inputs. Upload: overwrite, include-hidden-files, compression-level. Download: pattern, artifact-ids, merge-multiple, and run-id. github-token and repository are refused by name — the job token is used and an artifact never crosses a repository.

Cross-run consumption. A run-id names another run of the same repository; it is never automatic. The consuming run is held at pending_approval until a maintainer approves (a fork run, or a job holding a repository/environment secret, is refused by name), and every cross-run read is audited. While a workflow_run parent hold is pending, the read is 409 naming the parent run.

List, download, delete. GET …/api/threads/{run}/artifacts lists (id, name, files, total_size, created_at, expires_at), GET …/artifacts/{name} returns one manifest, and DELETE …/artifacts/{name} needs the write role and reports bytes_freed. A closed retention window is a 404 on both reads even before GC runs; a manifest path that escapes the archive root is refused on extraction and on the ZIP writer, so a corrupt record cannot become a zip-slip.

Schedules. Default branch only; a process with the maintain role must be running. A CAS'd watermark fires each tick at most once, so a restart does not duplicate a deploy and a crash loses one tick rather than repeating it. Entries can be disabled and enabled without a commit, and run now fires one on demand — even while disabled. A backlog coalesces to one run and reports the count; it is never replayed.

Retention. Two operator windows. threads.retention (default 30 days) deletes a terminal run; logs, jobs and queue entries go with it. Checks do not, so an old required check still gates a merge. threads.artifact_retention is the artifact's own lifetime (created plus its upload retention-days, else the window), so an artifact can outlive the run that produced it. threads.keep_forever = true reclaims neither. A queued, running or pending-approval run is never swept, and neither is a run with a live job lease; the GC report names bytes per family and has a dry run that deletes nothing.

Cache: a workspace tree across runs.

restore a dependency cachevalid
name: cache
on: push
jobs:
  build:
    runs-on: linux
    steps:
      - uses: spindle/checkout
      - name: keep npm inside the workspace
        run: echo "npm_config_cache=.npm" >> "$SPINDLE_ENV"
      - uses: spindle/cache
        id: cache
        with:
          path: .npm
          key: npm-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
          restore-keys: |
            npm-${{ runner.os }}-${{ github.ref_name }}-
      - if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci

What it does. spindle/cache restores at the step and saves at the end of a green job (/save saves now, /restore never saves). Keys are exact; restore-keys (up to 10 prefixes) fall back to the most recent matching entry. The step publishes cache-hit — "true" only on an exact key match — and a miss is silent success unless fail-on-cache-miss is set. path must be workspace-relative (absolute paths and ~ are refused): point the tool at .npm, .cache/pip, GOCACHE and cache that directory.

Scopes and isolation. A default-branch run reads and writes default; another branch reads and writes its own branch and reads default; a same-repository PR reads and writes pr:<n> and reads its base; a fork's entry lives in pr:<n>:untrusted, which no trusted run reads; a tag run is read-only. A PR can never write a base-readable entry, and no PR reads another PR's cache. A merged PR's scopes are discarded. Content is addressed and integrity-checked, so a key collision can only select bytes the writer actually produced.

Limits. 1 GiB per entry, a 5 GiB repository budget (oldest-first eviction), 256 entries, and a 7-day idle window — all operator keys under [threads] (cache_max_entry_bytes, cache_max_bytes, cache_max_entries, cache_retention). The cache is derived data, never an artifact: the sweeper reclaims expired entries and orphaned payloads.

setup-* recipes. setup-node, setup-go and setup-python resolve as remote actions when the instance's policy admits them, and their cache: input is rewritten around this built-in pair. Without the action (or when it is refused), the same cache half is a recipe: npm_config_cache: .npm plus a cache of .npm; GOCACHE/GOMODCACHE under .cache/ plus both cached; PIP_CACHE_DIR: .cache/pip plus that cached. An unmapped setup action or cache manager is refused by name.

Operations

Tags, supersede, schedules, conformance.

What runs and what wins: a tag is its own ref, a newer push replaces older work, a schedule is an owned entry, priority orders the queue, and the engine's compatibility claims are gated.

Tag runs. A tag push is a first-class ref. The run header carries the full refs/tags/<tag>, github.ref_name is the tag, and the container's SPINDLE_REF/SPINDLE_REF_NAME (aliases GITHUB_REF/GITHUB_REF_NAME) carry the tag. A tag and a branch of the same short name are independent: separate runs, separate concurrency, separate supersede keys.

Supersede. A newer push to the same (workflow file, ref) cancels the older in-flight run; the superseded run reads cancelled, names its successor (superseded_by) and says supersede as the reason. A dispatch or a cron tick never supersedes, and a run that already ended is untouched. A workflow that declares a concurrency: group is never implicitly cancelled — the group is the explicit serialisation choice, so cancel-in-progress decides.

Rerun. A full re-run resets every job at a new attempt. Re-run failed (the run page or POST …/api/threads/{run}/rerun-failed) advances the attempt and re-queues only the failed jobs plus their transitive dependents; a successful job that is not downstream of a failure keeps its state, step results and green check. Image, container-option and environment gates are re-applied to every re-run job, and a gated deployment is held for a fresh approval.

Conformance. make parity runs the living matrix gate and the committed corpus: every green row must name a test that exists, the plan's id set must match, and the generated matrix must be a fresh render. At the last close the matrix is 119 rows — 117 have, 0 partial, 0 missing, two signed non-goals. It needs no docker and no network. make parity-exec is the opt-in execution tier: it boots a server and a runner, executes the committed golden of a real publish workflow byte-unmodified, then builds, pushes and pulls a small image through a local registry:2 with a daemonless builder (no socket in the job). It needs a Docker daemon and is deliberately not in the CI gate, because every CI job is itself a container with no daemon; when the tier is requested, a missing daemon is a failure, not a skip.

Schedules. The Threads page lists every entry with its next fire, its persisted watermark and any coalesced ticks. Each row has disable/enable (no commit, audited) and run now (allowed on a disabled entry, audited): spindle threads schedule list|enable|disable|run. A disabled entry keeps its watermark; re-enabling fires on the next due tick.

Pause and priority. spindle threads pause (or the page toggle, or POST …/api/threads/pause) stops the repository claiming jobs while in-flight jobs finish; every queued job says "CI is paused for this repository", and resume restores claims immediately. A manual dispatch may carry priority 0…10 (spindle threads run --priority 5); claim order is priority descending, then FIFO, and priority never bypasses an approval hold, a pause, a cap or a trust gate. spindle threads queue shows the live order.

Feedback. Checks carry annotations (level, file, line — stored and rendered, never changing the state), a per-workflow badge (GET …/threads/badge.svg?workflow=…&branch=…), and run-list filters (workflow, state, branch, event, actor; a bounded scan, with more saying whether it was capped). A failed run notifies watchers through the three channels in Notifications — the in-app inbox, an optional repository webhook, and email when the operator configures it. A single job can be cancelled without ending its siblings (POST …/threads/{run}/jobs/{job}/cancel); a non-forced cancel ends through the runner's ack, a forced one is terminal at once.

No silent queue. Every queued job names exactly one reason, in the order the read model checks them: the run's hold (an approval, or the repository's concurrency_cap), CI pause, a deployment queued behind an environment's serialization slot (naming the environment and queue position), a live needs: dependency, the pending concurrency group, a max-parallel matrix slot, then runner availability — no runner is registered, no runner matches labels …, fork runs are disabled on every matching runner, all matching runners are busy, waiting for a matching runner or a declared CPU/memory ceiling. The field is derived on read, so it changes the moment the cause clears.

tag-triggered and scoped by refvalid
name: Release
on:
  push:
    tags: ["v*"]
concurrency:
  group: release-${{ github.ref_name }}
  cancel-in-progress: false
jobs:
  publish:
    runs-on: linux
    steps:
      - uses: spindle/checkout
        with:
          fetch-tags: true
      - run: echo "releasing $SPINDLE_REF_NAME at $SPINDLE_SHA"

Merge queue: one entry at a time.

For the workflow author. A queue entry is handed to CI as a push to a read-only ref, refs/heads/gh-readonly-queue/<base>/pr-<number>-<sha>. That push starts exactly one merge_group run — never a push run — with github.ref set to the queue ref, github.ref_name to its short name and github.sha to the ref tip (the computed merge commit). The workflow file is read from the base branch tip: both sides of an entry are repository-owned, so there is no fork trust question and secrets follow the normal rules. The payload carries action: checks_requested, number (the pull request) and merge_group.head_ref/head_sha/base_ref/base_sha. The run's jobs mirror onto the checked merge commit, so a normal require_checks rule gates the entry; the queue needs no merge-group-specific check code.

For the maintainer. Enqueue an open pull request from its PR panel, the Queue tab, or POST …/api/merge-queue/enqueue. A queue is per base branch and runs one entry at a time, ordered by priority (0…100, higher first) and then FIFO. The entry moves pending → validating → landing, and lands through the repository's one merge task with both parents pinned and the required checks re-read on the checked commit — every protection gate still runs. A failing check, conflict, refusal or timeout ejects the entry with the gate's own reason and deletes the temporary ref; the pull request stays open. Pause stops starting the next entry; dequeue is allowed while pending or validating (the author may also remove their own entry), and a restart deletes the stale ref and re-prepares rather than wedging.

.spindle/workflows/queue.ymlvalid
name: Queue checks
on:
  merge_group:
    types: [checks_requested]
    branches: [main]
permissions:
  contents: read
jobs:
  test:
    runs-on: [self-hosted, linux, docker]
    steps:
      - uses: spindle/checkout
      - run: go test ./... -count=1

The same workflow can also listen on pull_request; the queue run is the one that sees the merge result. Name its check contexts in the base branch's require_checks and the queue's landing gate reads them on the checked merge commit.

Queue refs are not branches: clone advertisements, the branch list and commit pages omit them, while an explicit git fetch origin 'refs/heads/gh-readonly-queue/*' still works for a deliberate read.

Merge queue API
CallWhat it does
GET …/api/merge-queueThe repository view: per-base queues with live positions, recent outcomes and the audit tail.
POST …/api/merge-queue/enqueue{base, number, priority?} → 202 with the entry; maintain role.
POST …/api/merge-queue/dequeue{base, number} → the cancelled entry; maintain, the PR author or the enqueuer.
POST …/api/merge-queue/pause / resumeStop or restart starting the next entry, for one base or every existing base; maintain role.
GET …/api/pulls/{num}/merge-queueThe PR's entry with its live position, or 404; read role.

Out of scope, named: batched entries (pr-<a>-<b>-<sha>) and speculative validation of the next entry. One entry per run keeps the failure attribution exact, and the documented ref shape names one pull request.

Notifications: in-app, webhook, email.

A signed-in user watches a repository (the page toggle, or PUT …/api/threads/subscription) and gets one notice per failed run, never one per retry or state fold. All three channels share the failure-only filter and the run link, and the outbound messages carry the run's job mask values; the inbox record's key is the dedupe, so a run produces at most one message per subscriber.

  • in-app inbox — on with a watch. One durable record per (user, run) in the Threads panel and GET …/api/threads/notifications; mark all read is a POST.
  • repository webhook — off. The repository's notify_webhook switch sends one POST with the run summary and link.
  • email — off. A standard-library SMTP notifier, enabled with threads.smtp.host (plus from, and optional port, username/password, tls, timeout). One message per subscriber and failed run to the subscriber's verified address, masked like the log; an unresolvable mask list skips the email rather than sending it unmasked. Credentials are refused over a plaintext connection, and a delivery failure is logged, never retried into a loop.

The inbox is the durable fact; the webhook and email are outbound hints detached from the run's completion, so an unavailable mail server cannot delay a run folding. There is no user-scope secret (D-22): a run executes as the repository, so a per-user credential would have no honest reader.

A job-token push never starts a workflow, so a tag created by a CI job is silent by design. A branch and a tag named v1 never share a supersede key: the key includes the refs/heads/ or refs/tags/ prefix.

Fleet

Runners you can name, size and retire.

A runner declares its labels and capacity, then long-polls for work. Groups narrow who sees what, a one-job worker self-destructs, declared ceilings become exact queue reasons, and the fleet has ordinary operations: drain, resume, rotate, deregister.

Runner fleet surfaces
ShapeWhat it does
--capacity NN concurrent jobs on one daemon; they are not isolated from each other. Default 1.
--ephemeralA one-job worker: it exits after a single job and the server deletes its record and credential (the only shape that cannot linger).
--max-cpus, --max-memoryA declared ceiling. A job that needs more waits with an exact named reason instead of being silently mis-scheduled.
runner groupInherited labels plus a visibility allowlist, intersected with the runner's own policy — a group can only narrow. Admin-set, never runner-set.
runner serve --config FILESeveral [[runner]] scopes from one process, each with its own 0600 credential file.
runner drain|resume|rotate|deregisterFinish and claim nothing new / undo it / rotate with a 15-minute overlap / delete the record and credential. rotate and drain never leave a worker holding a dead token.
runner images [--label L]Prints the stock toolchain catalogue (Ubuntu, node, python, go, rust, docker CLI — each pinned by manifest digest) and the matching --labels line. --label go resolves one label and refuses an unknown label by name. The images are upstream toolchains; spindle publishes and mirrors none — --image-prefix points an air-gapped instance at its own mirror.
threads validate [PATH|-]Offline validation with the server's own parser: a file, a directory of direct *.yml/*.yaml children, stdin, or --repo DIR for DIR/.spindle/workflows; --json for the machine report. Exit 0 valid, 1 invalid or unreadable, 2 usage.
threads explain FILEOffline summary of a local workflow: triggers, jobs, runs-on, needs — the same parser the push path uses, with key paths and lines.

Stock toolchain labels.

A workflow that names one of these labels and no container.image runs in the upstream image, pinned by manifest digest at fetch time — a mutable tag never decides the bytes. The catalogue is data, not magic: spindle runner images prints it with the exact digests and the --labels line, and --label go resolves one entry.

Stock toolchain labels
runs-on labelPinned upstream imageToolchain
ubuntu-latestubuntu:24.04@sha256:…base Ubuntu 24.04
nodenode:22-bookworm@sha256:…Node.js 22 LTS + npm
pythonpython:3.13-bookworm@sha256:…CPython 3.13 + pip
gogolang:1.25-bookworm@sha256:…Go 1.25 toolchain
rustrust:1-bookworm@sha256:…Rust stable + cargo
dockerdocker:27-cli@sha256:…docker CLI + buildx (daemonless builds)

Precedence: an explicit container.image wins; otherwise a runner's own label:docker://… mapping wins; otherwise the stock entry. A typo is never a silent fallback — spindle runner images --label typo refuses by name, and a job whose label no runner declares stays queued with a reason. spindle publishes no images of its own; an air-gapped instance reaches the same bytes through its mirror (--image-prefix).

Non-goals, refused by name. There is no managed pool: spindle runner pool refuses and the documented path is ephemeral/capacity-1 workers under your own supervisor (D-14). There are no hosted Windows/macOS runners, no LXC or unisolated host backend, and no artifact attestations (D-15): a windows-*/macos-* label queues with a reason naming the non-goal, lxc:///host are declare-time errors, and the attestations permission is a parse refusal. Each is listed by threads.NonGoals() and pinned by a test, not merely omitted.

The fleet is operator state, not workflow syntax. A workflow cannot add a runner, widen a grant or change its own isolation; a runner with any container grant refuses fork runs. The full flag table, tenancy and the dedicated-worker topology are in the reference (threads.md §8).

Recipes

The shapes that cover most CI.

Test-only CI for Go

copy, commit, donevalid
name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
permissions:
  contents: read
jobs:
  test:
    runs-on: [self-hosted, linux, docker]
    container: golang:1.27
    timeout-minutes: 20
    steps:
      - uses: spindle/checkout
      - run: go mod download
      - name: formatting
        run: test -z "$(gofmt -l .)"
      - run: go vet ./...
      - run: go test ./... -count=1

Tag a release

A landed tag starts a run of any workflow whose on.push.tags matches, so a release can be tag-triggered: on: push: tags: ["v*"] with if: startsWith(github.ref, 'refs/tags/v'). If you prefer one manual button, dispatch a version input and create the tag in the job — that tag push is silent, because it is authenticated by the job token. Both shapes are valid; pick one so a release does not run twice.

release taggingvalid
name: Release
on:
  workflow_dispatch:
    inputs:
      version:
        description: "Tag to create, e.g. v1.4.0"
        required: true
        type: string
permissions:
  contents: write
jobs:
  tag:
    runs-on: [self-hosted, linux, docker]
    container: golang:1.27
    steps:
      - uses: spindle/checkout
        with:
          fetch-depth: 0
      - name: validate and tag
        env:
          VERSION: ${{ inputs.version }}
        run: |
          case "$VERSION" in v[0-9]*.[0-9]*.[0-9]*) ;; *) echo "not a vX.Y.Z tag" >&2; exit 1 ;; esac
          git tag -a "$VERSION" -m "release $VERSION"
          git push origin "refs/tags/$VERSION"

Release a CLI: web once, matrix build, one release

spindle's own release is .spindle/workflows/release.yml: a plan job computes the next version from the repository's tags (a tag push names it directly), a web job builds web/dist once, a four-cell build matrix downloads it and cross-builds linux/darwin × amd64/arm64 into reproducible archives, and a release job publishes them through the repository API with a contents: write job token. The dispatch form offers a bump dropdown (patch/minor/major), so the operator never types a version: the highest final tag is bumped (major → X+1.0.0, minor → X.Y+1.0, patch → X.Y.Z+1; the repository has no v* tag yet, so the bootstrap treats the project's last published v0.17.2 as the previous release: v0.17.3 for patch, v0.18.0 for minor and v1.0.0 for major — the first run creates that tag on the instance, and the bootstrap is never used again). building the bundle once is the point: web/dist is embedded into every binary, so four independent web builds would be four chances to drift. The archives are tar.gz plus a per-file .sha256 and a combined SHA256SUMS. runs-on names a runner label (linux), never a toolchain: the Node image is declared with container: node:22-bookworm, because a runs-on: node only matches a runner that advertises a node label and a fleet runner carrying linux/docker/self-hosted would queue forever. The workflow spells everything in spindle's own names (SPINDLE_*, spindle/checkout, spindle/upload-artifact, spindle/download-artifact); GITHUB_*/github.* and actions/* are import aliases only. The full file and its explanation are in the guide; this is the shape.

.spindle/workflows/release.yml (condensed)valid
name: Release
on:
  push:
    tags: ["v*"]
  workflow_dispatch:
    inputs:
      bump:
        description: "Version bump"
        required: true
        default: patch
        type: choice
        options: [patch, minor, major]
permissions:
  contents: write
jobs:
  plan:
    runs-on: linux
    container: golang:1.27-bookworm
    outputs:
      version: ${{ steps.compute.outputs.version }}
    steps:
      - uses: spindle/checkout
        with:
          fetch-depth: 0
          fetch-tags: true
      - id: compute
        name: compute the version
        env:
          BUMP: ${{ inputs.bump }}
        run: |
          if [ "$SPINDLE_EVENT_NAME" != "workflow_dispatch" ]; then
            VERSION="$SPINDLE_REF_NAME"          # the tag names the release
          else
            LATEST=$(git tag --list 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
            BASE="${LATEST:-v0.17.2}"             # bootstrap for the first instance release
            REST=${BASE#v}
            MAJOR=$(echo "$REST" | cut -d. -f1)
            MINOR=$(echo "$REST" | cut -d. -f2)
            PATCH=$(echo "$REST" | cut -d. -f3)
            case "$BUMP" in
              major) VERSION="v$((MAJOR + 1)).0.0" ;;
              minor) VERSION="v${MAJOR}.$((MINOR + 1)).0" ;;
              *) VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))" ;;
            esac
          fi
          echo "$VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$' || exit 1
          printf 'version=%s\n' "$VERSION" >> "$SPINDLE_OUTPUT"
  web:
    runs-on: linux
    container: node:22-bookworm
    steps:
      - uses: spindle/checkout
      - name: build the embedded bundle once
        run: |
          corepack enable
          corepack prepare pnpm@11.25.0 --activate
          pnpm --dir web install --frozen-lockfile
          pnpm --dir web run build
          test ! -e web/dist/htmx-ext-sse.js
          grep -q 'max-w-6xl' web/dist/app.css
      - uses: spindle/upload-artifact
        with:
          name: web-dist
          path: web/dist
          if-no-files-found: error
  build:
    needs: [plan, web]
    runs-on: linux
    container: golang:1.27-bookworm
    strategy:
      fail-fast: false
      matrix:
        goos: [linux, darwin]
        goarch: [amd64, arm64]
    steps:
      - uses: spindle/checkout
      - uses: spindle/download-artifact
        with:
          name: web-dist
      - name: cross-build and package
        env:
          GOOS: ${{ matrix.goos }}
          GOARCH: ${{ matrix.goarch }}
          CGO_ENABLED: "0"
          VERSION: ${{ needs.plan.outputs.version }}
        run: |
          go build -trimpath -buildvcs=false \
            -ldflags "-s -w -X main.buildSHA=${VERSION}" \
            -o dist/spindle ./cmd/spindle
          name="spindle_${VERSION}_${GOOS}_${GOARCH}"
          mkdir -p dist/stage
          cp dist/spindle dist/stage/spindle
          cp README.md LICENSE dist/stage/
          tar --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner \
            -czf "dist/${name}.tar.gz" -C dist/stage .
          rm -rf dist/stage dist/spindle
          ( cd dist && sha256sum "${name}.tar.gz" > "${name}.tar.gz.sha256" )
      - uses: spindle/upload-artifact
        with:
          name: spindle-${{ matrix.goos }}-${{ matrix.goarch }}
          path: |
            dist/*.tar.gz
            dist/*.sha256
          if-no-files-found: error
  release:
    needs: [plan, build]
    runs-on: linux
    container: golang:1.27-bookworm
    steps:
      - uses: spindle/checkout
        with:
          fetch-depth: 0
          fetch-tags: true
      - uses: spindle/download-artifact
        with:
          pattern: spindle-*
          merge-multiple: true
      - name: ensure the tag exists (dispatch only)
        env:
          VERSION: ${{ needs.plan.outputs.version }}
        run: |
          if [ "$SPINDLE_EVENT_NAME" != "workflow_dispatch" ]; then
            git rev-parse -q --verify "refs/tags/$VERSION" >/dev/null || exit 1
            exit 0
          fi
          if git rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then
            exit 0
          fi
          git config user.name "spindle release"
          git config user.email "release@spindle.invalid"
          git tag -a "$VERSION" -m "release $VERSION"
          git -c credential.helper='!f() { echo username=ci; echo password=$SPINDLE_JOB_TOKEN; }; f' \
            push origin "refs/tags/$VERSION"
      - name: publish through the repository API
        env:
          VERSION: ${{ needs.plan.outputs.version }}
        run: |
          api="$SPINDLE_SERVER_URL/$SPINDLE_REPOSITORY/api"
          auth="Authorization: Bearer $SPINDLE_JOB_TOKEN"
          curl -fsS -X PUT "$api/releases/$VERSION" \
            -H "$auth" -H 'Content-Type: application/json' \
            --data-binary '{"draft":false,"prerelease":false}'
          cd dist
          sha256sum ./*.tar.gz > SHA256SUMS
          for f in ./*.tar.gz SHA256SUMS; do
            name=$(basename "$f")
            sha=$(sha256sum "$f" | cut -d' ' -f1)
            curl -fsS -X POST "$api/releases/$VERSION/assets/$name" \
              -H "$auth" -H "X-Walgit-Asset-Sha256: $sha" \
              --data-binary @"$f"
          done

The artifact manifest paths are workspace-relative, so downloading web-dist at the workspace root restores web/dist exactly (a path: web/dist download would nest it as web/dist/web/dist). Each matrix cell uploads a uniquely named artifact because an artifact name is unique per run; pattern: spindle-* with merge-multiple: true then flattens the four cells back into one dist/. The release asset upload requires X-Walgit-Asset-Sha256; curl --data-binary @file supplies the Content-Length the server verifies.

Build an image without a Docker socket

A job container never receives a Docker socket, so docker build has no daemon to talk to. Use a daemonless builder image. Whether it can create namespaces is a property of the runner host — the job cannot request --privileged or capabilities.

buildah, daemonlessvalid
name: image
on:
  push:
    branches: [main]
jobs:
  image:
    runs-on: [self-hosted, linux, docker]
    container:
      image: quay.io/buildah/stable:latest
      options: "--ulimit nofile=65536:65536"
    steps:
      - uses: spindle/checkout
      - name: build
        run: |
          mkdir -p /etc/containers /var/lib/containers /var/tmp/containers
          printf '[storage]\ndriver="vfs"\nrunroot="/var/tmp/containers"\ngraphroot="/var/lib/containers"\n' > /etc/containers/storage.conf
          buildah bud --storage-driver vfs --isolation=chroot -t registry.example.com/acme/app:"$SPINDLE_SHA" .
      - name: push
        run: |
          test -n "${REGISTRY_TOKEN:?REGISTRY_TOKEN is not set}"
          buildah --storage-driver vfs login -u "$REGISTRY_USER" -p "$REGISTRY_TOKEN" registry.example.com
          buildah --storage-driver vfs push registry.example.com/acme/app:"$SPINDLE_SHA"

Migration

From a Forgejo workflow to Threads.

Most of a workflow translates mechanically, and the importer does it for you: convert, review the report, commit on a branch, run. What still needs a plan is the executable half of a remote action the importer cannot rewrite (the engine resolves and pins it under policy — keep that line by hand) and the host capabilities of a daemonless builder. The cache, artifacts, reusable workflows, pull-request triggers, run-name, defaults and max-parallel now translate.

The importer. Threads never reads .forgejo/workflows/ or .github/workflows/ — not as a fallback, not behind a flag. Migration is an explicit one-way conversion:

shellread-only by default
spindle threads import --from forgejo --repo .                # dry run: print the conversion
spindle threads import --from github --repo . --json          # the report, for machines
spindle threads import --from forgejo --repo . --apply        # commit on a new branch
spindle threads validate --repo .                             # check the committed files offline

The command is read-only by default, never edits the source directory and never pushes. Everything it cannot express is named in the report and marked # UNTRANSLATED: at its own site; the command exits non-zero, and --apply refuses to commit unless you pass --allow-partial. --apply commits on a new branch only — never the current branch, never the default branch, never a force push.

The banner while you migrate. A repository that still carries .forgejo/workflows or .github/workflows and no .spindle/workflows sees a banner on its Threads page: the foreign files it found and the exact command to convert them. It is display-only — the page lists a directory, parses and imports nothing, and creates no run; discovery still opens .spindle/workflows alone.

Checking a conversion offline. spindle threads validate [PATH|-] [--repo DIR] [--json] runs the server's own validator, so its file:line: key: message is what a push would report: a file, a directory of direct *.yml/*.yaml children, stdin, or --repo for DIR/.spindle/workflows. It exits 0 when every file parses, 1 when one is invalid or unreadable, and 2 for a usage error.

The committed conformance corpus is the proof: all four real Weave/Scriobh workflows convert with zero refusals, parse, and plan. One construct still needs a manual rewrite: an object-valued matrix axis (matrix.os: [{name: …}]) — target axes are scalars, so use a scalar axis or one include object per combination. make parity keeps the claim honest.

The translation table

Forgejo workflow to Threads translation
In a Forgejo workflowIn ThreadsNote
on: push / pull_request / schedulesameSame shapes, including paths and the full emitted pull-request types. Glob dialect is *, **, ?, + and ordered !.
on: release: types: [published], on: issuessameRead from the default branch tip; a release run reports the tag commit.
on: push: tags: ["v*"]sameA matching tag push starts the run; a tags-only trigger never matches a branch push.
on: push: paths:sameThe changed-file filter; a PR uses the merge-base diff.
runs-on: docker[self-hosted, linux, docker]Labels are exact and subset-matched.
runs-on: ubuntu-latestsame spellingMapped onto self-hosted + linux before matching; the image stays the runner's or the workflow's choice.
container: {image: …}sameDigest pins are honoured and may be required by policy.
uses: actions/checkout@v4uses: spindle/checkoutBuilt-in. The importer drops the @v4 suffix and writes Spindle’s own name; the actions/checkout spelling stays a migration alias.
with: fetch-tags: truesameCheckout supports fetch-depth, fetch-tags, ref and path.
setup-go, setup-node, setup-pythonsame uses: (the remote action, under policy), or a base image plus spindle/cacheThe importer refuses remote uses:, so keep the line by hand; once the engine resolves it, its cache: input is rewritten around the built-in spindle/cache pair. Without the action, the refusal names the exact recipe.
actions/cachespindle/cache (the actions/cache alias resolves too)Built in: path/key/restore-keys; keep path inside the workspace. A PR's writes stay PR-scoped.
on.workflow_call, with:, secrets:sameTyped inputs, declared secrets and output templates are the call's interface; a cross-repository call is pinned to a full SHA with explicit secrets.
${{ secrets.NAME }}same, or $NAMESecrets are environment variables and substituted; a whole-value env: entry is delivered by name.
${{ secrets.GITHUB_TOKEN }}$SPINDLE_JOB_TOKEN (alias $GITHUB_TOKEN)One automatic, scoped job token; the GitHub/Forgejo names are migration aliases of the same value.
github.event.inputs.xinputs.xDispatch inputs only.
github.actor${{ spindle.actor }}$SPINDLE_ACTOR and ${{ spindle.actor }} read the same principal; github.*/forgejo.* are value-identical aliases.
$GITHUB_SERVER_URL$SPINDLE_SERVER_URLAlso $SPINDLE_API_URL (/api/v1), the same origin; $GITHUB_SERVER_URL/$FORGEJO_SERVER_URL are aliases.
$GITHUB_OUTPUT$SPINDLE_OUTPUT (alias $GITHUB_OUTPUT)name=value or a heredoc.
$GITHUB_ENV / $GITHUB_PATH$SPINDLE_ENV / $SPINDLE_PATHLater steps of the same job only; protected names are refused. The GITHUB_*/FORGEJO_* spellings are aliases of the same files.
matrix.include / excludesameGitHub's merge rules; an include-only matrix is one cell per entry.
strategy.max-parallelsameLiteral 1…256 with a matrix translates; a value without a matrix is a named refusal.
defaults: (workflow or job)samedefaults.run.shell and working-directory as literals; an unknown key or an expression is refused by name.
run-name:sameA scalar title with github.*/inputs.* expressions translates.
uses: owner/repo@ref (a remote action)same line, kept by handThe engine resolves, pins and records it under the instance policy; the one-way importer still refuses to rewrite remote uses:, and says so in its report.
startsWith(...) in ifsamestartsWith, contains and format are supported.

Weave: a test job

Forgejo workfloworiginal
jobs:
  test:
    runs-on: docker
    container:
      image: golang:1.27@sha256:01aa…
    steps:
      - name: Checkout
        env:
          FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: eval "$CHECKOUT"
      - run: go vet ./...
      - run: go test ./... -count=1
Threadstranslated
name: CI
on:
  push:
    branches: [main]
  pull_request:
jobs:
  test:
    runs-on: [self-hosted, linux, docker]
    container:
      image: golang:1.27@sha256:01aa…
    steps:
      - uses: spindle/checkout
      - run: go vet ./...
      - run: go test ./... -count=1

The custom CHECKOUT script existed because the image had no Node for a JavaScript checkout action. The built-in checkout runs in the job container, so the token plumbing, the git init and the http.extraHeader all disappear. secrets.GITHUB_TOKEN is not needed.

Scriobh: a matrix release

The original builds four OS/arch pairs with matrix.include. Threads accepts that as written: an include-only matrix is one cell per entry, every include key is a declared matrix.* value, and the check names and artifact names stay distinct. The importer carries the list verbatim.

Forgejo workfloworiginal
strategy:
  fail-fast: false
  matrix:
    include:
      - { goos: linux,  goarch: amd64 }
      - { goos: linux,  goarch: arm64 }
      - { goos: darwin, goarch: arm64 }
      - { goos: windows, goarch: amd64 }
steps:
  - name: Checkout
    run: eval "$CHECKOUT"
  - name: Build
    env:
      GOOS: ${{ matrix.goos }}
      GOARCH: ${{ matrix.goarch }}
    run: CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -o dist/app
Threadstranslated
strategy:
  fail-fast: false
  matrix:
    include:
      - { goos: linux,  goarch: amd64 }
      - { goos: linux,  goarch: arm64 }
      - { goos: darwin, goarch: arm64 }
      - { goos: windows, goarch: amd64 }
steps:
  - uses: spindle/checkout
  - name: build
    env:
      GOOS: ${{ matrix.goos }}
      GOARCH: ${{ matrix.goarch }}
    run: CGO_ENABLED=0 go build -o dist/app
  - uses: spindle/upload-artifact
    with:
      name: dist-${{ matrix.goos }}-${{ matrix.goarch }}
      path: dist/app

Each artifact name is unique per run because both include keys are part of it. The four cells are exactly the original four; no extra combinations are produced.

What has no equivalent

Unsupported constructs and their workarounds
ConstructWhyWorkaround
remote / marketplace uses:resolved, pinned and audited by the engine under the instance policy (default-deny); the one-way importer will not rewrite the linekeep the remote line by hand after import, or use a base image, a run: step, a local action, or docker://
reusable workflows, remotea cross-repository callee must be public here, SHA-pinned and called with explicit secrets (D-6)a pinned owner/repo/.spindle/workflows/x.yml@<sha> call, a local call, or a workflow_dispatch chain
container.credentials / services.<id>.credentialsrefused by name (D-23): the pull identity belongs to the runner, not the file (PAR-077/PAR-078)the runner's docker config, its --image-prefix mirror, or --registry-auth-file
hosted windows-* / macos-* runnersa signed non-goal (D-15); the label queues with a reason naming ita Linux job, or run that job where the platform lives
docker build in a jobno Docker socket by defaultkaniko or buildah (daemonless); a runner whose operator granted --docker-host only, and it refuses fork runs
--privileged / --cap-addrefused unless the runner's operator passed --container-privilegedthe runner host must permit the build without per-job flags
Forgejo release/asset APIdifferent APIspindle's releases API, or keep publishing in Forgejo during migration

The safe order

  1. 1

    Tests only

    Replace the custom checkout with the built-in one. Read-only, no secrets. This proves labels, image, checkout reachability and duration before anything can be damaged.

  2. 2

    Matrix and services

    Prove every cell and the database sidecar, still read-only.

  3. 3

    Artifact-producing jobs

    Build, upload, download and verify inside Threads. Still no credentials.

  4. 4

    Keep publishing where it is

    Move the credential only after the spindle job has produced the same bytes twice; run both once in parallel and compare digests, not logs.

  5. 5

    Retire the old workflow

    Only after a release shipped from Threads. The rollback is re-enabling the old file — one revert.

Limits

What is not here, named.

The conformance matrix closes with no silent gaps: every row is green, a named clause, or a signed non-goal. This is the short list of what you might expect and will not find — each refused by name rather than accepted and ignored.

  • Batched merge-queue entries — the queue lands one pull request per run. The documented refs/heads/gh-readonly-queue/<base>/pr-<n>-<sha> shape names one PR, so a pr-<a>-<b>-<sha> batch ref is not produced and failure attribution stays exact. The trigger and queue are implemented (Merge queue); batching is the named future extension.
  • Hosted Windows/macOS, LXC or host backends, artifact attestations — signed non-goals (D-15): there is no isolated Windows/macOS fleet, an unisolated host backend is a cross-tenant hole, and attestations need a sigstore trust root this instance does not operate. A windows-*/macos-* label queues with a reason naming the non-goal; lxc:///host are declare-time errors; permissions: attestations is a parse refusal.
  • Managed runner pool — signed non-goal (D-14): unattended execution of untrusted code at scale is not a default an instance can drift into. spindle runner pool refuses by name; use ephemeral or capacity-1 workers under your own supervisor.
  • User-scope secrets — declined (D-22): a run executes as the repository, not a person, so a per-user credential would be readable by any workflow in it. Organization, repository and environment scopes exist; environment is the tightest.
  • Workflow-supplied registry login (container.credentials, services.*.credentials) — refused (D-23): the password would travel in the job payload and argv, and the pull identity belongs to the runner. Use the runner's docker config, an --image-prefix mirror, or --registry-auth-file.
  • Docker socket in a job — no daemon by default, so docker build exits 127 with a named remedy. Use kaniko or buildah (daemonless), or a runner whose operator granted --docker-host — which refuses fork runs.
  • case(...) in an expression — not a function in this language or the platforms it is compatible with; accepting it would invent semantics. Use if: conditions, or a run: shell case.
  • Expressions in structural fields — only runs-on and container.image substitute per cell; services.*.image, environment, defaults.run.* and the workflow/job/container env layers stay literal. Name the value literally, or create one job per case.
  • Email out of the box — off until an operator configures threads.smtp.*; there is no implicit mailer and no dependency for one. Enable it, or keep the in-app inbox and webhook.
  • make parity-exec in CI — needs a Docker daemon; every CI job is itself a container with no daemon. Run it on a developer host or an operator's host-mode runner.
  • The committed corpus — four real workflows from the operator's own repositories, converted with committed goldens. The public GitHub half of the original plan is not committed; each GitHub-only row is proved by its own unit or e2e test. Treat the matrix as the checklist; the corpus is the end-to-end proof, not the whole surface.

Nothing on this list is silently inert: an unsupported trigger, key, function or structural span is a parse error or a failed job with a reason naming it. The full matrix and every acceptance test live beside the plan (21_parity_master.md).

Troubleshooting

Start where it stopped.

The evidence is on the run page: the job's reason, its runs-on, the checkout URL, the step result, and the log. Read those before changing the file.

Symptom, cause and fix
SymptomCauseFix
No run after a pushNo workflow at that commit; the event or branch/tag does not match (a tags-only trigger on a branch push, a branches-only trigger on a tag); the file failed to parse; the ref was a delete or notes ref; the push used a job tokenThreads → Workflows lists files and parse errors; deletes and notes refs never fire; job-token pushes are suppressed
A file is rejectedUnknown key, bad type, unsupported cron, a types value the service never emits, an unsupported ${{ }} reference or if: function, a matrix over 256 cells, both run and uses, a bad needsThe error names the file and key; fix that file only — the others keep running. Reproduce it offline with spindle threads validate --repo ., which prints the same file:line: key: message as a push.
Run stays queuedThe job's queue_reason names it: no runner registered; labels are not a superset; a fork run with no fork-opted runner; all matching runners busy; a declared CPU/memory ceiling; CI pause; a deployment slot; a capacity hold; a live needs: dependency; a max-parallel slot; a concurrency group heldRead the chip on the run page — it names the one cause to act on; /admin/runners shows labels, capacity and last-seen; spindle threads queue shows the order
A remote action is refusedThe instance's action policy does not admit the reference: a mutable tag or branch outside the allowlist, mode = "deny", or a changed digest under a pinned commitThe reason names the reference, the policy key and both remedies: pin a full 40-hex commit, or add the repository to threads.actions.allow
Job failed before any stepImage refused by policy; a bad container option or a runner grant it did not opt into; an undefined environment; an unresolvable local action; a malformed reusable callThe job's reason names the field and value; a missing runner grant names the flag
Checkout failsThe image has no git; the clone URL is unreachable from the container; the commit is missingUse an image with git; read the reachability diagnostic; set the server's public URL
Push from a job refusedShallow clone; contents: read; protected ref; non-fast-forwardfetch-depth: 0, contents: write, a fast-forward, or relax the policy
Secret is emptyFork/untrusted run; no secrets key configured; wrong name; a whole-value reference in a non-step siteThe run shows an untrusted chip; names are exact; $X and ${{ secrets.X }} both work in a step
“did not publish the output”The step failed, was skipped, ran later, or wrote a different nameCheck steps.<id>.outcome and the exact name in $SPINDLE_OUTPUT
Artifact upload: no filesThe pattern matched nothing, or the working directory is wrongThe log names the patterns; use if-no-files-found: warn when empty is allowed
Artifact download is 404The retention window closed, or the name/id does not belong to that runList the run's artifacts — an expired artifact is 404 before GC frees it; re-run the producer if the bytes are still needed
Cross-run download is 409 naming the parentThe consuming run is a workflow_run follow-up whose upstream was untrusted, so its approval hold is still pendingA maintainer approves that run (the approval releases both the run and cross-run consumption); a fork run or a secrets-bearing job is refused outright
Cache never hitspath is absolute or ~; the key changes every run; a PR/fork scope cannot read the entry you expectPoint the tool at a workspace directory (.npm, .cache/pip); build the key from runner.os/branch, not github.sha, and use restore-keys
docker build exits 127The job has no docker socket or daemon by defaultUse a daemonless builder (kaniko, or buildah with vfs/chroot) or a runner whose operator granted --docker-host; that runner never takes fork runs
Image pull failedThe daemon cannot reach the mirror, the credential is refused, or the repository is absentRead the spindle: diagnostic: daemon DNS/TLS, $DOCKER_CONFIG, mirror repository key; a private pull is the runner's (--registry-auth-file), not a workflow credential
Run is pending_approvalThe first-time-fork gate, an environment with reviewers, an untrusted workflow_run upstream, or a cross-run artifact readA maintainer or listed reviewer approves on the run page; the page names which hold applies
pull_request_target does nothingThe repository switch is off (the default), or a head checkout is refusedA maintainer enables it on the Threads page (audited); a declarative head checkout needs the second switch
Run was cancelled with no humanA newer push to the same workflow and ref superseded itThe run names its successor (superseded_by) and the reason supersede; open the successor, or give the workflow its own concurrency: group
Approval never arrivesNo reviewer decided; there is no timeout and no auto-approvalA listed reviewer or repo admin must decide; a deleted environment fails closed
Schedule never firesBad cron; not on the default branch; no maintainer role; the tick already fired; the entry is disabledFix and merge to the default branch; run a maintainer; check the entry's switch, or use run now / spindle threads schedule run
A deployment is queued behind anotherOne deployment holds the environment's serialization slot; the record names the holderWait for the holder to reach a terminal state (the next waiter is promoted), or cancel the queued deployment
No email after a failed runEmail is off by default: threads.smtp.host is unset, or the subscriber has no verified address, or the run is not watched by themThe in-app inbox and webhook still fire; an operator enables email under threads.smtp.* (credentials require TLS)
Required check stays pendingIts job was never claimedA runner must claim it; the merge stays blocked by design