Open MercatoDocsSearch docsAPI reference

Deployment

Continuous Integration with GitHub Actions

Give a standalone application a CI pipeline that runs against each proposed change. Inspect the generated GitHub Actions configuration before enabling it.

The om-setup-ci skill generates a GitHub Actions pipeline for an app created with create-mercato-app. It carries over the checks and conventions the Open Mercato framework uses in its own CI, trimmed to what applies to a standalone app, and adds layered security scanning: dependency audit, secret scanning, SAST, workflow security, container scanning, and optional CodeQL and DAST.

It is one deterministic generator. It reads your package.json, Node pin, Dockerfile, integration-test harness and git branches, then writes the workflows, helper scripts and a documentation page into your repository. Checks whose scripts are missing are left out, and the reason is recorded.

Info · Availability

New apps get the skill in .ai/skills/om-setup-ci/ (core skill tier). Existing apps get it after upgrading Open Mercato and running yarn mercato agentic:init --update-harness. GitHub is the only supported provider for now.

Quick start

From the app root:

node .ai/skills/om-setup-ci/scripts/setup-ci.mjs --dry-run   # preview what will be generated
node .ai/skills/om-setup-ci/scripts/setup-ci.mjs             # write the files

Or ask your coding agent to "set up CI". The skill runs the same generator and asks only about what it cannot detect: which branches to protect, whether the repository needs a larger runner, and whether to enable CodeQL and the nightly DAST scan.

Then:

  1. Commit the generated files on a branch and open a pull request. The first run starts.
  2. In Settings → Branches, require the CI status check on your protected branches.
  3. In Settings → Code security, enable secret scanning push protection and Dependabot security updates.

What the pipeline checks

JobWhat it runsWhy
changesgit diff against the baseSkips jobs when nothing relevant changed, and fixes the baseline for "new findings only".
auditscripts/ci/audit-ci.mjs with the base yarn.lock as a baselineFails only on high-severity npm advisories the change introduces, and fails closed when advisory data is unavailable.
secretsGitleaks over every commit in the changeCatches credentials even when a later commit deleted them.
sastSemgrep on src/: Open Mercato rules plus p/default (ERROR)Blocks new code-execution, shell-injection, SQL-interpolation, XSS, open-redirect and cookie-flag patterns.
workflow-lintzizmor on .github/Expression injection, token permissions, credential persistence and unpinned actions in the workflows themselves.
lintyarn lintESLint with the Next.js rules. Runs in parallel and fails fast.
validateyarn generate → clean-tree check → yarn typecheck → yarn ds:check → time-bomb scan → yarn test → yarn buildThe same gate coding agents run before opening a pull request (.ai/agentic.config.json).
integrationyarn test:integration:ephemeralBoots the real app on a throwaway PostgreSQL container and runs the Playwright suites. Skipped when the app has no integration specs.
dockerdocker build without push, then Trivy on OS packagesCatches a broken Dockerfile, and fixable HIGH/CRITICAL CVEs in the base image.
CIAggregates all jobsThe single required check. A skipped job counts as passed.

Pull requests are gated only on what they introduce, so a change is never red for a problem that was already on the base branch. Existing problems are owned by two nightly workflows, each keeping one tracking issue open until it is fixed:

Why custom Semgrep rules

Semgrep's free registry rulesets barely cover Next.js route handlers and server actions. Against a deliberately vulnerable route, p/javascript, p/typescript, p/react and p/nextjs together reported nothing, missing exec() with user input and dangerouslySetInnerHTML. The Open Mercato rules (scripts/ci/semgrep/open-mercato.yml) target exactly those patterns. They allow the framework's safe idioms: constants, ? placeholder lists, and { sql, params } clause builders. On a fresh app they report nothing.

Supply-chain hardening

The generated workflows follow the same rules zizmor enforces, and the generator's own output passes zizmor and actionlint:

Options

OptionDefaultPurpose
--branches a,bdetected default branch, plus develop if it existsBranches the pipeline protects.
--node <version>.nvmrc / .node-version, else the engines.node majorNode.js version.
--runner <label>ubuntu-latestruns-on label. Use a larger runner if a private repository runs out of memory during the build.
--audit-severity <level>highLowest advisory severity that fails the audit.
--audit-cron "<expr>"17 6 * * *Schedule of the nightly audit.
--no-<check>all onTurn off secrets, sast, workflow-lint, lint, typecheck, ds-check, time-bombs, test, build, integration, docker, image-scan, scheduled-audit, scheduled-security, dependabot.
--with-code-scanningoffCodeQL workflow plus SARIF uploads to Security → Code scanning. Needs a public repository or GitHub Code Security.
--with-dastoffNightly OWASP ZAP baseline scan. Which alerts fail is set in scripts/ci/zap-rules.tsv.
--forceoffOverwrite generated files that differ from the templates.
--dry-run, --jsonoffPreview only, or print a machine-readable result.

Options are saved in .github/om-ci.json. After an Open Mercato upgrade, --force alone refreshes the pipeline to the latest templates and pinned versions and keeps your choices. It also resets any action pins Dependabot bumped since the last run to the generator's pins; Dependabot proposes the newer ones again on its next run.

What it does not cover

Scanners don't understand business rules. They won't notice an API route that skips a permission check or tenant scoping, and the DAST scan is unauthenticated and passive. Code review against the Open Mercato rules (feature-based guards, organization_id scoping, findWithDecryption for encrypted entities) and periodic penetration testing remain necessary. The generated docs/ci/README.md spells this out for the team.

Safety

Previous: Agent Orchestration Scaling · Next: Production Readiness