Skip to content

CI with the Action

Luis edited this page Dec 2, 2026 · 4 revisions

CI with the Action

Summarizes action.yml, ADR 0023 (the Action), ADR 0021 (--mode), ADR 0022 (--baseline) for main. If they disagree, the ADRs win. A full nightly workflow without the Action: Nightly scan.

--mode, --changed and --baseline need creep v0.2. With an older version, setting the mode or baseline input makes creep exit 2, which fails the job, and so does a pull request with the default incremental: true, which passes --changed: set incremental: "false" with v0.1.0.

A pull request and main workflow

Copy docs/examples/creep-action.yml to .github/workflows/creep.yml and replace the placeholders:

name: creep
on:
  pull_request: # never pull_request_target: it runs a fork's code with this repository's secrets
  push:
    branches: [main]
permissions: {}
jobs:
  scan:
    runs-on: ubuntu-latest
    timeout-minutes: 150
    permissions:
      contents: read
      security-events: write # upload SARIF to code scanning
      pull-requests: write   # the pull request comment; drop it with comment: "false"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 2 # the merge commit and the base commit, for --changed and the baseline
          persist-credentials: false
      - name: Policy, outside the repository
        run: |
          cat >"$RUNNER_TEMP/creep-policy.yaml" <<'EOF'
          defaults:
            model: { contract: openai, endpoint: "https://<host>/v1", name: "<model>" }
            egress: { allow: ["<host>"] }
          consent: ["https://<host>"]
          EOF
      - uses: Ludocius/creep@<commit SHA of the release tag> # <release tag>
        env:
          CREEP_POLICY: ${{ runner.temp }}/creep-policy.yaml
        with:
          version: <release tag>
          api-key: ${{ secrets.CREEP_API_KEY }}
          baseline: creep-baseline.json # optional; read from the base commit on a pull request

Everything creep trusts comes from outside the scanned repository: the policy (model, endpoint, consent) is written by the workflow, the model key is the only secret, and the repository's creep.yaml can only tighten the configuration. In CI nothing prompts: consent comes only from the policy's consent list. Pin the Action by the commit SHA of a release tag and name that tag in version; there is no moving v0 tag.

What the Action does

  1. Event and fork policy. Only pull_request, push, schedule, workflow_dispatch and merge_group run; any other event (pull_request_target, workflow_run, ...) fails, since those can run a fork's code with this repository's secrets. A pull request from a fork fails when any model key is present (api-key, CREEP_API_KEY, ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, OPENAI_API_KEY, GEMINI_API_KEY, GOOGLE_API_KEY) and otherwise runs without the comment. The Action never checks code out.
  2. Verified install. It downloads the release archive for the runner (Linux or macOS, X64 or ARM64; Windows runners are refused), checks its SHA-256 against checksums.txt and runs gh attestation verify against this repository's release workflow at that tag on a GitHub-hosted runner. Any failure stops before a binary runs.
  3. Scan. creep scan with --config, --mode, --changed and --baseline from the inputs, each validated first. The exit code is recorded and the step always succeeds, so SARIF upload and the comment run on a failed gate too.
  4. SARIF upload to code scanning (category creep). Code scanning annotates only alerts on changed lines; baseline-suppressed findings carry SARIF suppressions and do not show as open alerts.
  5. Pull request comment. One comment, found by a hidden marker and updated in place: a verdict line and .creep/report.md, whose repository and model strings are all escaped code spans. Cut at 60,000 bytes.
  6. Verdict. The job fails on every exit code but 0. Exit 4 (incomplete) fails exactly like 1 (gate), so a repository that lowers its own budget cannot turn a failing gate into a pass.

Inputs

Input Default creep flag Notes
version the tag the Action is used at vX.Y.Z (prereleases included); required when pinned by SHA
api-key "" passed as CREEP_API_KEY to the scan step only; refused on a fork pull request
config "" --config used instead of the user file and the repository's creep.yaml; empty reads CREEP_POLICY, user file, creep.yaml
mode "" --mode pr, nightly or empty (creep picks: nightly on schedule)
baseline "" --baseline repository-relative path; on a pull request read from the base commit; missing file: a notice, no baseline
incremental true --changed on a pull request only: git diff --name-only -z "$BASE_SHA...HEAD"; needs fetch-depth: 2
working-directory . keep the root when uploading SARIF
upload-sarif true needs security-events: write
comment true needs pull-requests: write; skipped on fork pull requests
github-token ${{ github.token }} download, attestation, upload, comment
creep-path "" self-test only: runs an unverified local binary; never set it in a real workflow

Outputs: exit-code, and sarif, report (JSON v1), markdown when creep wrote them (only after exit 0, 1 or 4).

Minimal permissions

Start the workflow with permissions: {} and grant per job:

Permission When
contents: read always
security-events: write upload-sarif: true
actions: read upload-sarif: true on a private repository
pull-requests: write comment: true

Nothing else. Verifying creep's public release attestation needs no permission. Use actions/checkout with persist-credentials: false, never pull_request_target, and protect .github/workflows with CODEOWNERS, because a pull_request run uses the pull request's own copy of the workflow. Make the scan a required check.

Gates per mode

--mode pr|nightly picks the gate that judges the run. It is never a config key, so the scanned repository cannot pick it; --mode always wins, and any other value (also an empty one) exits 2.

Mode Gate (default) Sandbox Chosen by
pr gates.pr (probable:critical) never: no build, no PoC, even with sandbox.enabled default
nightly gates.nightly (verified:high) and gates.pr builds the app and runs PoCs when sandbox.enabled --mode nightly, or GITHUB_ACTIONS=true with GITHUB_EVENT_NAME=schedule
  • A nightly scan also reads gates.pr, so it never passes what a pr scan of the same commit fails.
  • A nightly scan that could not verify (sandbox off, verification unavailable, or a PoC candidate with no completed run) reads gates.nightly at probable: verified:high becomes probable:high.
  • A finding no PoC template can verify (ssrf, command_injection, code_injection, insecure_deserialization, nosql_injection, scanner findings) is always read at probable in nightly mode; accept it with a baseline entry.
  • A PoC that ran and never verified leaves a probable finding: gates.pr still fails a critical one, but a 0/5 probable high passes both default gates. Set gates.nightly: probable:high in the user file or policy to fail on those too.
  • The policy's limits.gates.pr and limits.gates.nightly floor both keys in every mode; the project file may only make either stricter.
  • Every scan prints one gate: line on stderr, for example gate: nightly mode (GitHub Actions schedule event): gates.nightly "verified:high" (default) read as "probable:high": verification unavailable (no_runtime); gates.pr "probable:critical" (default) also applies; a finding with no PoC template is read at probable. creep config explain ends with mode and gate rows.

With the Action, a schedule event runs nightly with no mode input; mode: nightly forces it for any other event. Other CI systems (GitLab, Azure, Jenkins) pass --mode nightly in their scheduled job. For verification in CI, add sandbox: { enabled: true } to the policy and pull the images creep doctor lists (Nightly scan, Sandbox).

Incremental scans: --changed

--changed <file> (scan and estimate) evaluates only the paths the file lists, one repository-relative path per line or NUL-separated. creep never runs git, so build the list yourself:

git diff --name-only -z origin/main > changed.txt
creep scan --changed changed.txt

Use -z: creep refuses a quoted entry, an absolute path, a .. and a backslash (exit 2). Deleted files are counted and ignored; names match without regard to case. Every other source file is listed unchanged, by design (it does not make the run incomplete), and reports mark the run incremental. An incremental exit 0 means the listed files are clean, not the repository: a flow from a changed file into an unchanged one is not evaluated, so keep a full scan (for example nightly) as well. --baseline-write refuses an incremental run.

Baselines: --baseline

To gate only on new findings (ADR 0022):

creep scan --baseline creep-baseline.json --baseline-write   # once, from a complete run; commit the file
creep accept sink-3 --expires 90d --reason "admin-only tool, fix in #12"
creep scan --baseline creep-baseline.json                    # every later scan
Flag Command What it does
--baseline <file> scan the gate skips findings a live entry matches; each is still listed with its expiry and reason. No default, no config key
--baseline <file> accept the file to write (default creep-baseline.json)
--baseline-write scan rewrite --baseline from this run: live accepted risks kept, one baseline entry (90 days) per other probable or verified finding. Only from a complete, non-incremental run; a refused write never exits 0
--expires <n>d accept 1d to 365d, required
--reason <text> accept one printable line, at most 200 bytes, required

A finding matches by fingerprint (class, path and redacted sink line), so moving lines keeps it; editing the sink line, moving the file or changing the class makes it new. Every entry expires; an expired entry stops suppressing. not_evaluated and discarded findings are never suppressed, and an incomplete run still exits 4. A malformed baseline, a link in its place or an expiry over a year away exits 2.

In a pull request, read the baseline from the base commit, so the pull request cannot suppress its own finding. The Action does this. In other CI:

git show "$BASE_SHA:creep-baseline.json" > "$RUNNER_TEMP/baseline.json"
creep scan --baseline "$RUNNER_TEMP/baseline.json"

Exit codes

Code Meaning Action job
0 nothing blocking passes
1 a finding reached the mode's gate fails
2 usage or configuration error (bad --mode, bad baseline, ...) fails
3 model or sandbox error fails
4 incomplete run: report written, not everything evaluated (budget, budget.max_seconds deadline, ...) fails

The Action in brief

Moved from the README (2026-12-02).

The repository root is a composite Action (ADR 0023). Full example: docs/examples/creep-action.yml.

permissions:
  contents: read
  security-events: write   # SARIF upload to code scanning
  pull-requests: write     # the pull request comment; not needed with comment: "false"
steps:
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
    with: { fetch-depth: 2, persist-credentials: false }
  - uses: Ludocius/creep@<commit SHA of the release tag> # <release tag>
    env:
      CREEP_POLICY: ${{ runner.temp }}/creep-policy.yaml   # model, endpoint and consent, written by an earlier step
    with:
      version: <release tag>
      api-key: ${{ secrets.CREEP_API_KEY }}
  • Verified install. It downloads the release archive for the runner (Linux or macOS, X64 or ARM64) and runs it only after its SHA-256 matches checksums.txt and gh attestation verify accepts its build provenance from this repository's release workflow at that tag, built on a GitHub-hosted runner. version defaults to the tag the Action is used at; pinned by commit SHA, set it. There is no moving v0 tag.
  • Forks and events. It runs on pull_request, push, schedule, workflow_dispatch and merge_group, and fails on any other event (never use pull_request_target). On a pull request from a fork it fails if a model key is set, and otherwise runs without the comment. A fork's pull request gets no key, so the example skips that job and scans the change on push after review.
  • Verdict. Every exit code but 0 fails the job, and 4 (incomplete) fails exactly like 1: a pull request whose creep.yaml lowers its own budget cannot pass. SARIF upload and the comment still run first.
  • Pull requests. With incremental (default) it scans only the changed files (--changed, from the base commit; check out with fetch-depth: 2). The baseline input is read from the base commit on a pull request or a merge group, so the change under review cannot suppress its own finding.
  • Comment and annotations. One comment, found by a hidden marker and updated in place, holding creep's Markdown report, which escapes every repository and model string. It is found again among the token account's comments: the workflow token's or a personal token's; with a GitHub App token a new comment is posted each run. Annotations come from code scanning, which marks on a pull request only the alerts its SARIF adds; keep working-directory at the repository root when uploading. creep emits no fixes yet, so there are no suggestion blocks (deferred to the v3 fix stage).
  • Inputs. version, api-key, config (--config), mode (--mode), baseline, incremental, working-directory, upload-sarif, comment, github-token; outputs exit-code, sarif, report, markdown. creep-path exists only for the Action's own self-test (CI job action) and runs an unverified binary.

Clone this wiki locally