A GitHub Actions job can use your secrets without storing a single secret on GitHub. maruhi ci run and maruhi ci sync authenticate with the job’s own OIDC token, verify everything they receive against the project’s signed chain, and keep the decrypted values in memory. Your GitHub secrets can be empty: the maruhi API token does not exist in CI, and the platform tokens and the values themselves live in maruhi. The secrets a workflow cannot lease, such as a Dependabot secret, can be synced into GitHub from maruhi, with one bootstrap token as the single exception.
This page covers what a project owner sets up once, a job that runs a command with leased values, the two standard shapes for syncing a deploy target from CI, and how to require a second person before production is written.
What a job needs
- The CLI. The
setup-maruhiaction installs it from the release assets and verifies the SHA-256 checksum before anything is put on the runner. Reference it asmaruhiapp/maruhi/actions/setup-maruhi@<tag>and pin it to a release tag or a commit SHA, never to a branch: it installs the binary that will hold your decrypted values. Passversion: <tag>as well while releases are pre-release tags, becausereleases/latestcannot be resolved yet and the install script refuses to guess. Linux and macOS runners are supported; Windows runners are not. permissions: id-token: writeon the job. Without it the runner does not expose the OIDC token endpoint, and the command stops with an error that says so. maruhi needs no other permission and noGITHUB_TOKENscope.- A lease grant whose policy matches the job (below). A job the policy does not list gets a uniform 404.
- The repository anchor,
.maruhi/anchor.json, committed and passed as--anchor. It is optional, and every template on this page includes it. See Repository anchor.
Everything else is a flag. CI mode reads no keychain and no config file except the sync config, maruhi.sync.json, so the server, the project, and the anchor path are visible in the workflow file, where they are reviewed like the rest of your CI.
Set up once
Grant a lease with a policy
A project owner discloses the environments a CI job may lease and, in the same command, the policy that says which jobs may lease them. This runs on the owner’s machine, not in CI:
maruhi server grant --environments production,tokens --lease-policy lease-policy.json[
{
"issuerUrl": "https://token.actions.githubusercontent.com",
"audience": "https://my.maruhi.app",
"claimConstraints": {
"repository": "acme/app",
"environment": "production"
}
}
]audienceis your server’s origin. That is the audiencemaruhi ci runandmaruhi ci syncrequest by default (--audienceoverrides it), and the two must match.claimConstraintsare exact matches against the claims of the job’s OIDC token. Every element needs at least one constraint, and a job is authorized when any one element matches all of its constraints. To allow several jobs, add one element per job.- The policy is one list per project, and a job that matches any element can lease every environment in the grant. Keep that in mind when you write elements for jobs with different levels of trust; see Four eyes on production.
- The policy lives on the project’s signed chain: only an owner can change it, and the server cannot. Re-run
maruhi server grantto tighten or replace it at any time. The list of disclosed environments can only grow; shrinking it ismaruhi server revoke, which rotates every environment. - Every member sees the grant. A grant lets the server decrypt the values of the environments it names, so while the project’s verified chain carries one, every command that opens the project (
maruhi pull,maruhi run,maruhi push,maruhi member list, …, andmaruhi ci runin the job itself) printsNote: project <project ID> is disclosed to the server (CRYPTO_SPEC §9): server key <fingerprint> can decrypt the values of environments production, tokens, one line per granted server key.maruhi env listmarks those environmentsdisclosed-to-server=yes, andmaruhi project verifylists each grant with its fingerprint, scope, lease policy and the chain entry that made it; the fingerprint is the onemaruhi server revoke --fingerprinttakes when several keys are granted. All of it comes from the verified chain, never from what the server reports, and it stops once the grant is revoked. A project without a grant prints nothing.
Claims worth constraining (GitHub’s OpenID Connect reference lists them all):
| Claim | Use it for |
|---|---|
repository |
Always (acme/app). A fork runs its copy of the workflow under its own name, so a token from a fork never matches. |
environment |
Production (production, or the target’s name). The claim is present only when the job references a GitHub Environment of that name, which is what lets required reviewers gate the lease. See Four eyes on production. |
ref |
A job that runs on a branch and references no Environment (refs/heads/main). A pull request run carries refs/pull/<number>/merge, so list the refs you need, one element each. |
workflow_ref |
Pinning one workflow file on one branch (acme/app/.github/workflows/deploy.yml@refs/heads/main). |
Do not constrain sub. GitHub changed its default format for repositories created after July 15, 2026 (it now embeds owner and repository IDs), so the value depends on when the repository was created; the claims above do not.
Repository anchor
A CI job is an unattended client with no memory of the chain head it verified last time, so a compromised server could serve it an old but validly signed view, for example a pre-rotation view that keeps a leaked credential deployed. The repository anchor closes this: a project member commits a small non-secret file with the chain head and the epoch of every environment, and --anchor refuses any response whose chain does not contain that head or whose epochs fall below it.
maruhi project anchor > .maruhi/anchor.json
git add .maruhi/anchor.json && git commit -m "chore: update maruhi anchor"The file contains hashes, sequence numbers, and epoch numbers, and no key material or values. An anchor older than the chain is still accepted (it is a floor), so re-run this after every maruhi env rotate: until you do, the anchor cannot tell a pre-rotation view from the current one.
Run a command with leased values
maruhi ci run leases one environment and runs a command with its values in the child process’s environment, and nowhere else. This is the shape for tests, builds, and any tool that reads its credentials from environment variables:
# .github/workflows/test.yml
name: test
on:
push:
branches: [main]
pull_request:
permissions: {}
# The coordinates the maruhi commands below read through their flags. The
# names are yours; the CLI reads no environment variable in CI mode
env:
MARUHI_SERVER: https://my.maruhi.app
MARUHI_PROJECT: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write # maruhi ci run authenticates with the job's OIDC token
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Pin to a release tag or a commit SHA. Replace <tag> with a release tag
# that contains the actions/setup-maruhi directory; the same tag is the
# version to install (required while releases are pre-release tags)
- uses: maruhiapp/maruhi/actions/setup-maruhi@<tag>
with:
version: <tag>
- run: npm ci
- name: Test with leased values
run: >-
maruhi ci run
--server "$MARUHI_SERVER"
--project "$MARUHI_PROJECT"
--env test
--anchor .maruhi/anchor.json
-- npm testReplace <tag>, the two values under env, and the environment name. In one round-trip, maruhi ci run generates an ephemeral key pair in memory, mints an OIDC token, requests the lease, verifies the chain against the pinned project ID, that an active grant on that chain covers the environment, every signature, every DEK commitment, and the anchor, and only then decrypts. The child gets the values as environment variables; the runner’s disk and the job log never see them. To lease several environments in one job, run it once per environment: each invocation mints its own token and its own key.
For a pull request run from a branch of the repository, the policy needs an element that matches it (for example repository plus event_name: pull_request). A pull request from a fork runs with read-only permissions, so its job cannot request an OIDC token at all, and maruhi ci run stops before contacting the server.
Sync a deploy target from CI
maruhi ci sync <target> copies a target from maruhi.sync.json the way maruhi sync apply does locally, with the differences described under In CI: it leases instead of signing in, it keeps no receipt, so it writes every selected variable on every run and deletes nothing, and a production target needs --yes in the workflow file. Which shape to use depends on who deploys:
- You deploy from CI (Cloudflare Workers, and any platform whose deploy is a command in your workflow): re-apply on every deploy. The secrets are written right before the deploy, by the same job, so the platform never runs a version whose secrets are older than the values in maruhi. Nothing else is needed.
- The platform deploys itself from Git (Vercel, Netlify, and any Git-integrated platform): sync on demand and on a schedule.
maruhi pushtriggers the workflow the moment a value changes, and a schedule re-applies the targets you list, in case a value was edited at the platform. - The target is GitHub itself (a
github-actionstarget that writes repository, Environment, or Dependabot secrets): the same on-demand and scheduled workflow, with one bootstrap token. See GitHub secrets as a target.
Both shapes use the http driver in the templates: the platform’s token is a variable in a maruhi environment (tokens below), leased by the same job, so nothing is stored on GitHub. The exec driver works in CI too if you would rather use the vendor CLI: install it in the job (a project dependency, not npx) and let it sign in from a CLOUDFLARE_API_TOKEN or VERCEL_TOKEN variable in the job’s environment. That token is then a GitHub secret, which is what the http driver spares you.
Re-apply on every deploy
A deploy workflow for a Cloudflare Worker. The worker target is the one from the http driver example: driver: http, token: { "environment": "tokens", "name": "CLOUDFLARE_API_TOKEN" }. The same tokens environment holds CLOUDFLARE_ACCOUNT_ID for wrangler (or put account_id in the wrangler configuration file).
# .github/workflows/deploy.yml
name: deploy
on:
push:
branches: [main]
permissions: {}
# The coordinates the maruhi commands below read through their flags. The
# names are yours; the CLI reads no environment variable in CI mode
env:
MARUHI_SERVER: https://my.maruhi.app
MARUHI_PROJECT: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
# Deploys go one at a time. A newer push waiting on this group replaces an
# older one that has not started yet; the one that runs deploys the latest commit
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
# A GitHub Environment. Put required reviewers on it for a second pair of
# eyes, and name it in the lease policy (claim "environment")
environment: production
permissions:
id-token: write # maruhi ci sync and ci run authenticate with the job's OIDC token
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Pin to a release tag or a commit SHA. Replace <tag> with a release tag
# that contains the actions/setup-maruhi directory; the same tag is the
# version to install (required while releases are pre-release tags)
- uses: maruhiapp/maruhi/actions/setup-maruhi@<tag>
with:
version: <tag>
# wrangler as a project dependency (use your package manager)
- run: npm ci
# Secrets first, so the version deployed next starts with them. The
# target's token comes from the leased "tokens" environment (http driver).
# --yes: this target is production, and the decision to write it is here
- name: Sync secrets to the Worker
run: >-
maruhi ci sync worker --yes
--server "$MARUHI_SERVER"
--project "$MARUHI_PROJECT"
--anchor .maruhi/anchor.json
# wrangler signs in with CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID
# from the leased environment; they reach wrangler's process and nothing else
- name: Deploy
run: >-
maruhi ci run
--server "$MARUHI_SERVER"
--project "$MARUHI_PROJECT"
--env tokens
--anchor .maruhi/anchor.json
-- ./node_modules/.bin/wrangler deployReplace <tag>, the two values under env, and the target and environment names. The lease policy for this job is the example under Grant a lease with a policy: repository: acme/app and environment: production, for the environments production (the target’s source) and tokens.
- Each
maruhi cicommand mints its own OIDC token: this job takes two, and three leases (the sync leasesproductionandtokens, the deploy leasestokens). They count against the project’s lease window, 300 per hour by default. - The
httpdriver does not create a Worker. Deploy a new Worker once before the sync step runs against it (the sync stops with a message that says so), or run the two steps in the other order for that first deploy. - The shell recipe does the same copy without a config file:
maruhi ci run --env production -- jq … | wrangler secret bulkbefore the deploy, with wrangler signed in the same way. - A named wrangler environment (
staging) is a second target withoptions.environmentand a second job, or a second workflow; the shape does not change.
Sync on demand and on a schedule
A sync workflow for the web target of the Sync on push example, with driver: http and token: { "environment": "tokens", "name": "VERCEL_TOKEN" } added so that the job has a token, and "onPush": "workflow" with "workflow": { "file": "maruhi-sync.yml" } so that every maruhi push to its environment dispatches this file. The same file has a schedule.
# .github/workflows/maruhi-sync.yml
name: maruhi sync
on:
# `maruhi push` runs `gh workflow run maruhi-sync.yml -f target=<name>` for a
# target with "onPush": "workflow". Anyone with write access can dispatch it too
workflow_dispatch:
inputs:
target:
description: Target name from maruhi.sync.json
required: true
type: string
# Re-apply the targets listed under SCHEDULED_TARGETS, in case a value was
# edited at the platform. Runs on the default branch, in UTC
schedule:
- cron: "37 4 * * *"
permissions: {}
env:
# The coordinates the maruhi command below reads through its flags. The
# names are yours; the CLI reads no environment variable in CI mode
MARUHI_SERVER: https://my.maruhi.app
MARUHI_PROJECT: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
# The targets the schedule re-applies, separated by whitespace. A target whose
# GitHub Environment has required reviewers waits for an approval on every run
SCHEDULED_TARGETS: web
jobs:
# Which targets this run syncs: the dispatched one, or the scheduled list.
# Both are checked against the config, so a typo or a removed target stops
# here instead of creating a stray Environment below
targets:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
list: ${{ steps.list.outputs.list }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: list
env:
TARGET: ${{ inputs.target }}
run: |
if [ -n "$TARGET" ]; then names="$TARGET"; else names="$SCHEDULED_TARGETS"; fi
for name in $names; do
jq -e --arg t "$name" '.targets | has($t)' maruhi.sync.json > /dev/null \
|| { echo "maruhi.sync.json has no target named $name" >&2; exit 1; }
done
list=$(printf '%s\n' $names | jq -cRn '[inputs | select(. != "")]')
echo "list=$list" >> "$GITHUB_OUTPUT"
sync:
needs: targets
# success(): a custom `if` decides on its own, so say that a failed
# targets job (unknown target) skips the sync rather than starting it
if: success() && needs.targets.outputs.list != '[]'
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.targets.outputs.list) }}
runs-on: ubuntu-latest
# One GitHub Environment per target, named after it. Put required reviewers
# on the production target's Environment, and name it in the lease policy
environment: ${{ matrix.target }}
# Runs for one target go one at a time. A newer run waiting on this group
# replaces an older one that has not started; every run writes the current values
concurrency:
group: maruhi-sync-${{ matrix.target }}
cancel-in-progress: false
permissions:
id-token: write # maruhi ci sync authenticates with the job's OIDC token
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Pin to a release tag or a commit SHA. Replace <tag> with a release tag
# that contains the actions/setup-maruhi directory; the same tag is the
# version to install (required while releases are pre-release tags)
- uses: maruhiapp/maruhi/actions/setup-maruhi@<tag>
with:
version: <tag>
# --yes: a production target is written only because this file says so.
# GH_TOKEN is the one GitHub secret this page needs: the token gh signs in
# with to write GitHub secrets for a github-actions target. Store it as a
# secret of that target's Environment, so that only its approved runs get
# it; for every other target the expression is empty and nothing reads it
- name: Sync the target
env:
TARGET: ${{ matrix.target }}
GH_TOKEN: ${{ secrets.GH_SECRETS_TOKEN }}
run: >-
maruhi ci sync "$TARGET" --yes
--server "$MARUHI_SERVER"
--project "$MARUHI_PROJECT"
--anchor .maruhi/anchor.jsonReplace <tag>, the two coordinates, and SCHEDULED_TARGETS. The lease policy for the web target names its Environment, environment: web, for the environments production and tokens; a second CI-synced target is a second element with its own Environment name. The GH_TOKEN line matters only for a GitHub secrets target; leave it in place or drop it, the other targets ignore it.
- From a push. With
"onPush": "workflow",maruhi pushrunsgh workflow run maruhi-sync.yml -f target=webwith the writer’s own GitHub sign-in and reports that the run was accepted. The command line carries the workflow name and the target name, never a value or a variable name; the job reads the values from maruhi. The writer never holds the platform’s token. - From the schedule.
SCHEDULED_TARGETSis the list of targets the schedule re-applies, checked against the config like a dispatched name. It is a choice, not a copy of the config: a target you sync only from your machine (thepreviewtarget of the example, which uses the vendor CLI with"onPush": "apply") has no token in maruhi and stays off the list. The schedule re-applies the current values of maruhi. It does not compare them with what the platform holds or report a difference; a value edited in the platform’s dashboard is overwritten, quietly, on the next run. - Which config runs.
workflow_dispatchandscheduleboth use the workflow file and themaruhi.sync.jsonof the repository’s default branch (or ofworkflow.refwhen the target sets it). A target added on a branch does not exist for the dispatched run until the branch is merged; thetargetsjob then stops with the target’s name. - Several runs for one target. Pushes in a row, or a push during a scheduled run, queue runs for the same target. The
concurrencygroup runs them one at a time, and GitHub keeps at most one run queued per group: a newer one replaces an older one that has not started. Because every run reads the values at the moment it runs, the last run to finish has written the current values, whichever order the runs started in. - Receipts. CI keeps none, so a
maruhi sync plan webon your machine still shows what CI delivered as pending, and the next localmaruhi sync apply web --yesrewrites it once. This is described under Receipts. - In a public repository, GitHub disables the schedule after 60 days without repository activity; a push re-enables it. Scheduled runs can be delayed under load.
Rotate a credential from CI
maruhi ci rotate <name> runs a rotation rule of maruhi.rotate.json under the job’s lease and stores the new credential as a sealed proposal — encrypted to the device keys of the members who may accept it — instead of pushing it (a job holds no signing key). A member finishes the rotation with maruhi rotation accept <id> from their own machine. The job needs the same grant and policy as maruhi ci run, plus an environment that holds the admin input the rule names:
# .github/workflows/rotate.yml
name: rotate
on:
schedule: [{ cron: "0 9 1 * *" }]
workflow_dispatch:
permissions: {}
env:
MARUHI_SERVER: https://my.maruhi.app
MARUHI_PROJECT: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
# One rotation of this environment at a time: two overlapping runs would
# both create a credential at the issuer, and only one proposal per
# variable can be pending (the second strands its credential)
concurrency:
group: maruhi-rotate-prod
cancel-in-progress: false
jobs:
rotate:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: maruhiapp/maruhi/actions/setup-maruhi@<tag>
with:
version: <tag>
- run: >-
maruhi ci rotate STRIPE_SECRET_KEY
--server "$MARUHI_SERVER"
--project "$MARUHI_PROJECT"
--env prod
--anchor .maruhi/anchor.json
--rotate-config maruhi.rotate.jsonThe rule must leave the previous credential valid until a member finalizes (a dual-credential rule — every built-in connector except a PostgreSQL rule without roles, which rotates the password in place, or an exec rule with a finalize script); one that invalidates the current credential at once is refused before the issuer is touched. The proposal expires after seven days unless --expires-in says otherwise (at most 30). See Rotation from CI for what the member sees and the audit rows.
GitHub secrets as a target
The goal of this page is a repository whose GitHub secrets are empty. maruhi ci run gets there for everything that runs as a command of yours. What it cannot reach is read by GitHub itself before your command runs: the with: input of a prebuilt action, a Dependabot secret (registry credentials for its updates), the secrets: inherit of a reusable workflow. For the prebuilt action, the better fix is usually to run the vendor CLI it wraps under maruhi ci run and drop the secret. For the rest, a github-actions target copies the values from maruhi into GitHub secrets, so that they too have one source of truth and one place to rotate them. It runs gh secret set on the runner, where gh is preinstalled, through the exec driver (the preset has no other; see GitHub Actions secrets for what it writes and refuses):
"dependabot": {
"preset": "github-actions",
"environment": "ci",
"variables": ["NPM_TOKEN"],
"options": { "repo": "acme/app", "app": "dependabot" }
}Add the target’s name to SCHEDULED_TARGETS, or set "onPush": "workflow" on it, and the workflow above syncs it like any other target. Two things are specific to it:
- The bootstrap token is the one exception to empty GitHub secrets. The job’s own
GITHUB_TOKENcannot write secrets (there is nosecretspermission to grant it), soghneeds a token that can: a fine-grained personal access token restricted to this one repository, with Secrets: Read and write for repository secrets, Environments: Read and write for Environment secrets, and Dependabot secrets: Read and write for"app": "dependabot", and nothing else (a GitHub App installation token with the same permissions works too). Store it as a secret of the target’s GitHub Environment (the Environment named after the target,dependabothere), not as a repository secret: theGH_TOKENline in the workflow then resolves to it only in that target’s job, after its reviewers approved the run, and to an empty string in every other job. As a repository secret it would instead reach every job of the workflow, and throughmaruhi ci syncevery vendor CLI anexectarget starts there (maruhi passes the job’s environment on to the vendor CLI, minus its ownMARUHI_*variables).ghreadsGH_TOKENfirst andGITHUB_TOKENsecond; the runner sets neither as an environment variable, so nothing else competes. Set an expiration on the token and rotate it in the Environment when it expires; it is the only credential this page leaves on GitHub. - The target must not write its own bootstrap. A
github-actionstarget with"variables": "all"copies every variable of its maruhi environment into GitHub; if that environment held a variable named like the bootstrap secret (GH_SECRETS_TOKENhere), the workflow would overwrite the token it runs with. Keep the bootstrap out of maruhi, or out of the target’s variables.
What maruhi ci sync prints for this target is the plan and Running gh in …; gh’s own output appears only when it fails, with the values filtered out. Nothing is written to $GITHUB_ENV or $GITHUB_OUTPUT.
Four eyes on production
Only a person can write a production target. Locally, that person types maruhi sync apply <target> --yes. In CI, the --yes is in the workflow file, reviewed with the rest of the repository, and the run itself is started by anyone with write access (a maruhi push with "onPush": "workflow", a gh workflow run, the Actions tab) or by the schedule. To require a second person before production is written, put the job in a GitHub Environment with required reviewers. maruhi’s own four-eyes policy covers the project’s chain — who is a member, which server keys are granted, the policy itself — not the delivery of values to a target, so the second pair of eyes on a deploy is GitHub’s:
- Create the Environment (repository settings, Environments):
productionfor the deploy shape, or the target’s name (web) for the sync shape, whose job referencesenvironment: ${{ matrix.target }}. A workflow that references an Environment that does not exist creates it, without protection rules, so create it before the first run. In a personal repository the owner does this; in an organization repository it takes admin access. In the deploy shape, reviewers onproductionhold every push tomainuntil someone approves the deploy, not only the secrets: add them if that is the deploy policy you want. - Add required reviewers: up to six people or teams with at least read access; one approval lets the job proceed, and a rejection fails the run. Turn on Prevent self-review so that the person who triggered the run cannot approve it. That is the second pair of eyes. On the Free, Pro, and Team plans, required reviewers are available for public repositories only.
- Restrict deployment branches to the default branch.
maruhi pushdispatches the workflow on the default branch and the deploy workflow runs onmain, so nothing legitimate is blocked, and a run from another branch cannot reference the Environment. - Name the Environment in the lease policy (
environment: production,environment: web, one element per Environment). Theenvironmentclaim is in the token only when the job references that Environment, and GitHub sends such a job to a runner only after the reviewers approved it. So the maruhi server hands out the production lease only to a run that a reviewer approved: a workflow edited to leave the Environment out gets a 404, whoever edited it.
What the reviewers see is the run, its trigger, and the person who started it, not the values: nothing has been decrypted when they decide. They approve the delivery of the current production values of maruhi, which were pushed by a member of the project; the plan the job prints, with variable names and versions, is in the job log after they approve. To look before approving, run maruhi sync plan <target> on your machine.
Two limits of the arrangement:
- The policy is one list per project. Point 4 holds for every environment in the grant as long as every element of the policy names a protected Environment. If the same policy also has an element for an unprotected job (a preview target synced from CI, or the test job above), that job’s identity can lease the production environment too, and only the workflow file keeps it from writing production. Grant the environments such jobs need, and keep production in a grant whose policy names protected Environments only, or sync the non-production targets from the writer’s machine with
"onPush": "apply"instead of from CI. - A scheduled run waits for approval too, every time. If that is too often, lower the cadence or take production out of
SCHEDULED_TARGETS: a push still triggers a reviewed sync at once.
A run that waits for approval writes the values as they are when it finally runs, not as they were when it was started, so approving an older run never delivers an older value than the one in maruhi. When several runs for one target wait, approve the newest and reject the rest.
What can go wrong
- 404 for the lease. One uniform answer covers an unknown project, no grant, a policy mismatch, and an environment outside the grant. With the right
--serverand--project, the usual cause is a claim: the job runs on a branch the policy does not list, references no Environment (or another one) while the policy constrainsenvironment, or runs in a fork. Fix the policy withmaruhi server grant --lease-policyor the workflow, not the server. - Unknown target. The dispatched run reads the
maruhi.sync.jsonof the default branch. Merge the config first. - The target’s platform fails.
maruhi ci syncshows the platform’s answer with the values and the token filtered out, and stops with a non-zero exit code; the next run writes every variable again. A Worker that does not exist yet is the common first-run case (see above). - The server issued a lease, but the chain it sent carries no active grant for the environment. The job refuses the lease before opening it. A conforming server never does this: it checks the grant on the same chain it sends and answers 404 instead. So the server is not following the protocol: it sent a chain other than the one it authorized against (for example one from before the grant), or it ignored the grant. Do not widen the grant to work around it; look at the server. With
--anchor, a chain older than the anchored head is refused by the anchor check first. - Anchor check failed. The response’s chain does not contain the anchored head, or an environment’s epoch is below the anchored one: the server served an old view, or the anchor belongs to another project. Do not re-run with the anchor removed; look at the server. An anchor that is merely behind the chain is accepted.
- After a rotation.
maruhi env rotatere-encrypts every value as a new version with the same plaintext. The next CI run writes the re-encrypted values, which is harmless, and the anchor should be updated (above). - 429. The project’s lease window is exhausted; the CLI does not retry. Each
maruhi ciinvocation takes one lease per environment it needs. ghexited with code 4, orHTTP 401/HTTP 403: Resource not accessiblefromgh secret set. Thegithub-actionstarget ran without a usableGH_TOKEN: the Environment secret is missing, the job does not reference that Environment, or the token lacks the Secrets, Environments, or Dependabot secrets permission for this repository.failed to fetch public key: HTTP 404usually means the GitHub Environment named in the target’s options does not exist yet, orreponames a repository the token cannot see.- A value ends with a newline, or a name is not uppercase.
maruhi ci syncrefuses to send anything to agithub-actionstarget and names the variable (ghwould strip the newline, and GitHub would rename the secret). A bad name is visible before CI runs:maruhi sync planmarks it with!. A trailing newline is found when the values are decrypted, before anything is sent. Push the value without the newline, or rename the variable in maruhi. - Values in the log. They are never printed by maruhi. Keep them out yourself: no
set -xin a command undermaruhi ci run, noechoof a variable, and nothing written to$GITHUB_ENVor$GITHUB_OUTPUT, which are files on the runner.
The action’s README lists the remaining server-side answers (token-replayed, server-wraps-missing, and the others).