Skip to main content

GitHub Actions

What each piece does:
  • fetch-depth: 0 so git:origin/main:openapi.yaml can be read from object storage. No checkout of the base branch is needed.
  • safe.directory because in a CI container the checkout is often owned by another user and git refuses to read it. pikopod detects this and prints the same fix, but setting it up front avoids a red run.
  • --format githubactions turns every finding into a workflow command carrying file, line and column, so it appears inline on the diff.
  • --handoff report.json writes the JSON report alongside the annotations.
  • pr comment posts one marker-tagged comment and updates it in place on re-runs. Platform, repository, PR number and head SHA are detected from the Actions environment. The token comes from GITHUB_TOKEN or GH_TOKEN, never from a flag.
If the token cannot comment (a read-only token on a fork PR), pr comment degrades: it writes the report to the job summary, or to stdout, and exits 0 with a note on stderr.

GitLab CI

pr comment detects GitLab from GITLAB_CI, reads the project and merge request IID from the CI variables, and needs GITLAB_TOKEN with api scope. Job tokens usually cannot post merge request notes.

Container image

The image is FROM scratch and runs as an unprivileged user:
There is no git inside the image, so use file sources or check the base version out to a path first.

Exit codes in CI

Treat 1 and 2 differently. 1 means the provider changed something that breaks you. 2 means the tool could not run: a document did not parse, a $ref was refused, the checkout was unreadable. A gate that collapses them teaches people to ignore both. See Exit codes.

Gating on recorded traffic too

Once an agent has been observing a provider, add the offline replay gate to the same job. It needs the data_dir (or a copy of it) and no network:
See Replay gate.

Running the sandbox in CI

Scenario runs need no server: pikopod scenario run builds its own engine in-process.
Pin --seed so transcripts are byte-identical between runs. Packs are looked up in ./scenarios first, then in <data_dir>/scenarios, so a committed scenarios/ directory is the regression suite.