Gitslice docs
Automations
Run folder workflows on repository events or invoke secure manual runbooks with typed inputs, folder-scoped secrets, Cloudflare Workers, and ephemeral Cloudflare Containers.
How automations work
- Committed beside your code: Put
.gitslice/automations.yamlin any folder. Changes in that folder or below it evaluate its automations and those of every ancestor folder, regardless of which slice authored the change. Inspect effective automations, checks, owners, and secrets withgs policyor the folder Policy drawer in the web UI. - Four action types:
httpsends a signed JSON webhook;workerruns a JavaScript ES module from.gitslice/in an isolated Cloudflare Dynamic Worker;bashexecutes shell commands or scripts inside a single-run Cloudflare Container; andcheckdispatches checks from.gitslice/checks.yamlon the account CI runner pool. - Secure manual runbooks: Add
manualtoonwith typedinputsand optionalmanual.roles,manual.require_human, andmanual.confirmguards. Admins can expose safe, locked-down capabilities (such asdeploy-staging) to writers or agents without ever handing them raw credentials. - Trusted landed definitions: Gitslice always loads
.gitslice/automations.yamland referenced scripts from the head of the target ref (refs/global/main), never from an unsubmitted changeset. Any edit under.gitslice/requires approval from an account owner or admin.
Write an automations.yaml
# services/billing/.gitslice/automations.yaml
version: 1
automations:
deploy-staging:
description: Deploy the billing service to staging
on: [manual]
manual:
roles: [admin, writer]
require_human: true
confirm: "Deploy billing service to staging?"
inputs:
version:
type: string
required: true
description: Release tag or commit SHA
pattern: "^[a-zA-Z0-9._-]+$"
region:
type: choice
options: [us-central1, europe-west1]
default: us-central1
dry_run:
type: boolean
default: false
secrets: [CLOUDFLARE_API_TOKEN]
network: [api.cloudflare.com] # http-gate: sealed placeholder unwrapped at egress
concurrency: serial
timeout: 10m
action:
bash:
runtime: cloud # base | node | python | go | cloud
size: basic # lite | basic | standard-1 | standard-2
checkout: folder # none | folder | account
run: |
echo "Deploying $INPUT_VERSION to $INPUT_REGION (dry_run=$INPUT_DRY_RUN)"
curl -fsS -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
https://api.cloudflare.com/client/v4/user/tokens/verify
notify:
on: [push]
refs: [main]
paths: ["**/*.go", "!**/*_test.go"]
secrets: [DEPLOY_TOKEN, DEPLOY_HMAC]
action:
http:
url: https://deploy.example.com/hooks/billing
headers:
Authorization: "Bearer ${{ secrets.DEPLOY_TOKEN }}"
sign: DEPLOY_HMAC # X-Gitslice-Signature-256: sha256=<hex>For http actions with sign set, Gitslice sends X-Gitslice-Signature-256 formatted as sha256=<hex> (HMAC-SHA256 of the raw request body keyed by the named secret), along with X-Gitslice-Event-ID so receivers can deduplicate retries.
| Field | Meaning |
|---|---|
| description | Short summary shown in the folder policy drawer, Run modal, and CLI. |
| on | Events that start the automation: push, tag.created, changeset.created, changeset.updated, changeset.approved, changeset.submitted, changeset.abandoned, check_run.completed, manual, or call (reusable template invoked via action.uses). |
| paths | Globs relative to the folder, "/" for the account root, "!" to exclude. Default: any change under the folder. |
| changes | Filter by change kind: added, modified, deleted, moved. Default: any. |
| refs | Target refs such as main. Default: any. |
| inputs | Typed manual inputs (type: string | choice | boolean | number, description, required, default, options, pattern). Passed as event.inputs (worker) or INPUT_<NAME> env vars (bash). |
| manual | Manual invocation policy: roles ([admin, writer] or [admin]), require_human (true blocks agent accounts), confirm (prompt shown before running). |
| secrets | Folder secrets the automation may use (list [FOO] or slot mapping { TEMPLATE_SLOT: CALLER_SECRET } for action.uses). Sealed as opaque placeholders by default in worker and http-gate bash runs. |
| reveal | Subset of secrets exposed in plaintext (via gs.revealSecret(name) in workers, or $NAME and $GITSLICE_SECRETS_DIR/<NAME> in bash). Required for secrets used under egress: direct. |
| network | Allowlist of public HTTPS hosts (such as api.github.com or *.cloudflare.com) permitted through Gate for worker and http-gate bash automations. |
| egress | Bash actions only: offline (default when network is empty), http-gate (default when network is set; sealed secrets unwrapped at egress), or direct (full TCP/UDP internet for psql, ssh, aws, gcloud; requires reveal). |
| checks | Check names the automation may report. Each becomes <folder>/<name> and can be marked required on a slice. |
| concurrency | cancel-superseded (default for changeset events), serial, or parallel. |
| concurrency_group | Worker and bash actions: a name shared with the account's other automations (such as prod-server for deploy and rollback). No two runs in one group run at once; the others wait their turn, oldest first. Implies serial. |
| timeout | Maximum run duration. Default 5m (max 15m) for bash actions; default 1h (max 7d) for worker/check runs. |
| retry | Retry an interrupted worker or bash run up to 5 times. Default 0 (at most once). |
| action | http (url, headers, sign), worker (.js/.mjs module under .gitslice/), bash (Cloudflare Container shell run/script), check (checks from checks.yaml), uses (call an on:[call] reusable template), or steps (sequential multi-step pipeline). |
Bash automations on Cloudflare Containers
A bash action runs inline run: commands or a script: under .gitslice/ inside a fresh, single-run Cloudflare Container destroyed immediately upon exit. Inputs are passed strictly as data ($INPUT_<UPPER_SNAKE> and $GITSLICE_EVENT_FILE) — never text-interpolated into shell source.
| Runtime | Preinstalled tools |
|---|---|
| base (default) | Debian slim with bash, curl, jq, git, openssh-client, openssl, zstd, and gs-auto. |
| node | base + Node.js 22 LTS, npm, and pnpm. |
| python | base + Python 3.12 and uv. |
| go | base + Go 1.24 toolchain. |
| cloud | base + gcloud, aws, kubectl, psql, gh, and terraform for deploy and ops runbooks. |
- Three egress modes: Omit
networkfor offline execution (no public internet). Specifynetwork: [hosts...]for http-gate (default): Cloudflare disables direct internet and intercepts HTTPS throughGate, unsealing$SECRETplaceholders only for allowlisted hosts so raw secrets never enter container RAM. Useegress: direct+reveal: [SECRET]for non-HTTP TCP/gRPC CLIs such aspsql,ssh,kubectl,aws, orgcloud. - Secrets as env vars and tmpfs files: Every declared secret is injected as
$NAMEand written to an in-memory file at$GITSLICE_SECRETS_DIR/<NAME>(/run/secrets/<NAME>, mode0400), making multi-line credentials such as GCP service account JSON or SSH private keys clean to pass via--key-fileor-i. All log output is scrubbed of secret values in both the dispatcher and the server. - Helper CLI inside the container: Use
gs-auto check create|update,gs-auto state get|set,gs-auto set-output <key> <value>, andgs-auto set-details-url <url>without exposing the run token to shell code.
# services/billing/.gitslice/automations.yaml
version: 1
automations:
migrate-staging-db:
description: Apply SQL migrations to staging Postgres
on: [manual]
manual:
roles: [admin]
require_human: true
confirm: "Apply pending SQL migrations to staging?"
secrets: [STAGING_DATABASE_URL]
reveal: [STAGING_DATABASE_URL]
egress: direct
concurrency: serial
timeout: 15m
action:
bash:
runtime: cloud
script: scripts/migrate.shStart CI checks from an automation
A check action runs checks from the same folder's .gitslice/checks.yaml on the account's CI runner pool — letting automations.yaml control when CI runs while checks.yaml defines how. Set started_by: automation on those checks so they no longer run automatically on every patchset.
# .gitslice/checks.yaml
version: 1
defaults:
started_by: automation
checks:
test:
run: go test ./...
paths: ["**/*.go"]
# .gitslice/automations.yaml
version: 1
automations:
ci:
on: [changeset.created, changeset.updated, manual]
action:
check: [test]Worker scripts
A worker automation is a standard JavaScript ES module stored under .gitslice/. It may import sibling modules from the same .gitslice folder and has standard Web APIs (fetch, crypto.subtle, URL), with no external npm packages.
// services/billing/.gitslice/scripts/ci.js
export default {
async onEvent(event, gs) {
const check = await gs.checks.create({ name: "ci", status: "queued" });
await fetch("https://api.github.com/repos/acme/ci/actions/workflows/ci.yml/dispatches", {
method: "POST",
headers: { Authorization: `Bearer ${gs.secret("GH_TOKEN")}` },
body: JSON.stringify({
ref: "main",
inputs: {
commit: event.changeset.commit_id,
callback: gs.callbackUrl(),
},
}),
});
await gs.state.set({ checkId: check.id });
gs.waitForCallback();
},
async onCallback(request, gs) {
const body = await request.json();
const { checkId } = await gs.state.get();
await gs.checks.update(checkId, {
status: body.passed ? "passed" : "failed",
summary: body.summary,
});
gs.finish();
},
};| API | Purpose |
|---|---|
| onEvent(event, gs) | Entry point called once when the worker automation starts. |
| onCallback(request, gs) | Called for each HTTP POST to the run's callback URL until the run finishes. |
| gs.checks.create / .update | Report check runs with status, summary, detailsUrl, and file annotations (path, line or startLine/endLine, level, message). |
| gs.files.read(path) / .readText(path) / .list(dir) | Read files at the changeset patchset (default or { ref: "patchset" }), at its base ({ ref: "base" }), or at the current landed target ref ({ ref: "main" }); { at } is accepted as an alias for { ref }. |
| gs.changeset.get() | Fetch the changeset, its patchsets, and approvals with resolved usernames and attribution. |
| gs.changeset.diff(opts?) | Fetch the unified diff for the run's patchset (optional { paths, fromPatchset }, account-scoped, capped at 4 MiB). |
| gs.secret(name) | Returns an opaque placeholder that Gate swaps for the real secret value on outbound requests to allowed network hosts. Put it in a URL's path or query, a header, or the body; it cannot be the whole URL, since a secret may never decide where a request goes. |
| gs.revealSecret(name) | Returns the raw value for a secret listed in reveal when script code must compute with it directly. |
| gs.callbackUrl(data) | Generate a signed callback URL where an external system can POST results back to this run. |
| gs.waitForCallback() | Keep the run open after the current call returns, until gs.finish(), gs.fail() or the timeout. |
| gs.finish() | End the run as succeeded (or by its checks' results) once the current call returns. |
| gs.fail(message) | End the run as failed with your own message, without a stack trace, once the current call returns. |
| gs.setDetailsUrl(url) | Link the run to an https page outside Gitslice, such as the build it started; gs auto show and --follow print it. |
| gs.setOutput(key, value) | Emit a named output on the run (secret-masked) for downstream pipeline steps (${{ steps.<id>.outputs.<key> }}) and inspection. |
| gs.state.get() / .set(value) | Persist up to 64 KiB of JSON state across callbacks within the run. |
| gs.idempotencyKey(label) | Deterministic key that stays identical across retries of the same run. |
| console.log | Writes to the run's log with secret values masked as ***. |
Reusable automation templates
Define a reusable template in any folder by adding on: [call] in .gitslice/automations.yaml. Callers invoke it with action.uses, pass static or interpolated parameters via with, and bind folder secrets by name or slot mapping. Unbound template inputs automatically appear on the caller's manual Run modal and CLI prompt.
# /acme/platform/.gitslice/automations.yaml (reusable template)
version: 1
automations:
deploy-cloudrun:
description: Deploy a service to Google Cloud Run
on: [call]
inputs:
service: { type: string, required: true }
region: { type: choice, options: [us-central1, europe-west1], default: us-central1 }
image: { type: string, required: true }
secrets: [GCP_SA_KEY]
reveal: [GCP_SA_KEY]
egress: direct
action:
bash:
runtime: cloud
run: |
gcloud auth activate-service-account --key-file="$GITSLICE_SECRETS_DIR/GCP_SA_KEY"
gcloud run deploy "$INPUT_SERVICE" --region="$INPUT_REGION" --image="$INPUT_IMAGE"
gs-auto set-output service_url "https://$INPUT_SERVICE.run.app"
# /acme/services/billing/.gitslice/automations.yaml (caller)
version: 1
automations:
deploy-prod:
on: [manual]
manual: { roles: [admin], require_human: true, confirm: "Deploy billing to prod?" }
secrets:
GCP_SA_KEY: BILLING_PROD_GCP_KEY # template slot -> caller folder secret
reveal: [BILLING_PROD_GCP_KEY] # caller explicitly grants reveal + direct egress
egress: direct
action:
uses: /acme/platform/deploy-cloudrun # same-account live; cross-account must pin @v1.0.0 or @sha256:...
with:
service: billing-api # bound here; "region" and "image" stay promptable inputs- Pinning rules: Same-account references may omit a version pin to follow the caller's tree live, or pin
@<slice-tag>/@sha256:<commit>. Cross-account references must always pin an immutable public slice tag or commit SHA. To publish a versioned template for other accounts, expose its folder in a public slice and cut an immutable tag withgs tag create v1.0.0, then inspect it withgs auto inspect /<account>/<folder>/<name>@v1.0.0. - Caller-bounded security ceilings: Secrets always resolve from the caller's folder (never the template's). A template cannot reveal secrets, use
egress: direct, or exceed the caller's explicittimeoutwithout caller opt-in. Cross-account callers must also allowlist every host the template declares innetwork.
Official first-party automations
The public gitslice/automations slice publishes ready-to-use on: [call] integration templates pinned by immutable tags. Every template runs exclusively with sealed secrets through HTTP-Gate (no reveal or egress: direct required).
| Template | Secret, network & outputs |
|---|---|
| /gitslice/automations/slack-notify@v1.0.0 | Secret: SLACK_WEBHOOK_PATH · Host: hooks.slack.com · Output: delivered |
| /gitslice/automations/github-dispatch@v1.0.0 | Secret: GITHUB_TOKEN · Host: api.github.com · Outputs: dispatched_url, mode |
| /gitslice/automations/linear-sync@v1.0.0 | Secret: LINEAR_API_KEY · Host: api.linear.app · Outputs: issue_keys, issue_urls, synced_count |
| /gitslice/automations/vercel-deploy@v1.0.0 | Secret: VERCEL_DEPLOY_HOOK_PATH · Host: api.vercel.com · Outputs: job_id, job_state |
| /gitslice/automations/cloudflare-deploy@v1.0.0 | Secret: CLOUDFLARE_API_TOKEN · Hosts: api.cloudflare.com, registry.npmjs.org · Outputs: version_id, deployment_url |
# Inspect any template's full input schema, secrets, hosts, and tags:
# gs auto inspect /gitslice/automations/slack-notify@v1.0.0
version: 1
automations:
# 1. Slack notification on push (SLACK_WEBHOOK_PATH = path after https://hooks.slack.com/services/)
notify-slack:
on: [push]
secrets: [SLACK_WEBHOOK_PATH]
network: [hooks.slack.com]
action:
uses: /gitslice/automations/slack-notify@v1.0.0
with:
status: success
include_files: true
# 2. Trigger a GitHub Actions workflow on tag creation
trigger-gh-release:
on: [tag.created]
secrets: [GITHUB_TOKEN]
network: [api.github.com]
action:
uses: /gitslice/automations/github-dispatch@v1.0.0
with:
owner: acme
repo: app-mirror
mode: workflow_dispatch
workflow: release.yml
ref: main
# 3. Sync Linear issues (e.g. ENG-123) mentioned in changesets
linear-on-submit:
on: [changeset.submitted]
secrets: [LINEAR_API_KEY]
network: [api.linear.app]
action:
uses: /gitslice/automations/linear-sync@v1.0.0
with:
team_prefix: ENG
target_state: Done
# 4. Trigger Vercel deploy hook (VERCEL_DEPLOY_HOOK_PATH = path after .../integrations/deploy/)
deploy-frontend:
on: [push]
paths: [web/**]
secrets: [VERCEL_DEPLOY_HOOK_PATH]
network: [api.vercel.com]
action:
uses: /gitslice/automations/vercel-deploy@v1.0.0
with:
project_url: https://app.acme.com
# 5. Build and deploy a Cloudflare Worker with wrangler in the node container runtime
deploy-worker:
on: [push, manual]
secrets: [CLOUDFLARE_API_TOKEN]
network: [api.cloudflare.com, registry.npmjs.org]
action:
uses: /gitslice/automations/cloudflare-deploy@v1.0.0
with:
account_id: "0123456789abcdef0123456789abcdef"
directory: worker
build_command: npm run build
environment: productionMulti-step pipelines
Chain up to 20 sequential steps with action.steps. Each step can invoke a reusable template (uses) or run inline bash, worker, http, or check actions. Steps emit outputs via gs-auto set-output (bash) or gs.setOutput (worker) and pass them downstream with ${{ steps.<id>.outputs.<key> }}. Control error handling with if: success (default), if: failure, or if: always.
# /acme/services/billing/.gitslice/automations.yaml
version: 1
automations:
release:
on: [manual]
secrets: [GCP_SA_KEY, SLACK_WEBHOOK]
reveal: [GCP_SA_KEY]
egress: direct
action:
steps:
- id: build
bash:
runtime: go
checkout: folder
run: |
TAG="v$(date +%Y%m%d%H%M)"
gs-auto set-output image "gcr.io/acme/billing:$TAG"
- id: deploy
uses: /acme/platform/deploy-cloudrun
with:
service: billing-api
image: ${{ steps.build.outputs.image }}
- id: notify
if: always
http:
url: https://hooks.slack.com/services/${{ secrets.SLACK_WEBHOOK }}Inspect and run automations
gs auto ls [folder] # automations applying at a folder
gs auto inspect /acme/platform/deploy-cloudrun # inspect a reusable on:[call] template & tags
gs auto runs --changeset <id> # runs for a changeset (or --automation, --account)
gs auto show <run-id> # run status, template, outputs, and pipeline steps
gs auto logs <run-id> --follow # stream live stdout/stderr (including pipeline steps)
gs auto run <id> -i version=v1.4.2 --yes --follow # invoke a manual automation and follow logs
gs auto rerun <run-id> # rerun a finished automation
gs auto cancel <run-id> # stop a queued, running, or waiting runAn http automation ends when its endpoint accepts the post: its run says delivered in the log, and what the endpoint does next is not tracked. To follow an outside job to its end, use a worker that passes gs.callbackUrl() and calls gs.waitForCallback().
Try an automation before it lands
# On the server, as defined in an open changeset (one that lists secrets needs an account admin)
gs auto run <id> --from-changeset <changeset> --follow
# Locally with node, from the workspace's files, with a stand-in gs
gs auto run <id> --local --secret TOKEN=test-value --callback build-done.json--local runs a worker's onEvent, then onCallback once per --callback file, with the same rules as Gate: https only, hosts in network, and secrets only where they cannot change a request's origin. Secrets without a --secret value stay placeholders.
In the web UI, open the Policy drawer on any folder to inspect effective automations, run manual runbooks through the typed input modal, and stream live logs.
CI Checks
Define folder-scoped build and test checks and required submit gates.
Secrets
Scope encrypted tokens and credentials to folders for checks and automations.
