CI usage
Run flowpact on every pull request, fail on errors and contract drift, and keep the report.
The flowpact action
The simplest setup is the flowpact GitHub Action. It runs the same engine as the CLI and adds a job summary, inline annotations on the pull request and — when contracts drifted — the regenerated contracts as a downloadable artifact.
name: Workflow contracts
on: pull_request
permissions:
contents: read
jobs:
flowpact:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ciatlas/flowpact@v0.29
with:
mode: check # or lint, if you do not commit contractsNo paths filter on a required check
The workflow runs on every pull request. If you make the flowpact job a required status check, do not add a
paths: filter: a pull request that touches none of the paths skips the workflow, and GitHub then leaves the
required check pending, so the pull request cannot merge
(GitHub docs).
To filter a check that is not required, list everything flowpact reads: '.github/workflows/**',
'.github/flowpact/**', '**/action.yml' and '**/action.yaml' (a local action can live anywhere, including the
repository root).
Each finding is an annotation on the line it is about, in the pull request's Files changed tab:


The demo pull request shows the rest: the Windows leg is skipped and
the pipeline stays green, while the flowpact check fails. See GitHub Action for every input and output
(fail-on, SARIF upload, the contracts artifact, …).
The CLI in GitHub Actions
The CLI works in any job that has Node.js:
name: Workflow contracts
on: pull_request
permissions:
contents: read
jobs:
flowpact:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
- name: Check workflows and contracts
run: >-
npx --yes flowpact check --format github
-o markdown:"$GITHUB_STEP_SUMMARY"
--patch flowpact-contracts.patch
- name: Keep the regenerated contracts
if: always()
uses: actions/upload-artifact@v7
with:
name: flowpact-contracts
path: flowpact-contracts.patch
if-no-files-found: ignore- Use
flowpact lintinstead offlowpact checkif you do not commit contracts. --format githubannotates each finding on its file and line, in the run and the pull request, like the action. Leave it out to print the terminal report in the job log instead (GitHub's log viewer keeps its colors).-o markdown:"$GITHUB_STEP_SUMMARY"writes the Markdown report to the job summary.-ocan be repeated, e.g.-o flowpact.sariffor code scanning or-o flowpact-report.jsonfor a machine-readable report.- The step fails (exit
1) when there are errors, which inflowpact checkincludes missing, outdated, breaking, orphaned and invalid contracts. Use--fail-on warningto be stricter or--fail-on neverto report without failing. --patchwritesflowpact-contracts.patchonly when contracts drifted. Anyone can download it from the run and apply it withgit apply flowpact-contracts.patch— no local Node.js needed.- When you re-run a job with debug logging enabled, GitHub sets
RUNNER_DEBUG=1and flowpact switches to debug logs automatically.
Code scanning (SARIF)
To see findings in the Security → Code scanning tab and as pull request annotations, write SARIF and upload it:
permissions:
contents: read
security-events: write
steps:
# …checkout and setup-node as above
- run: npx --yes flowpact check --output flowpact.sarif
- if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: flowpact.sarif
category: flowpactPin the version
npx --yes flowpact@0.29 checkThe banner at the top of the log shows the exact tool and schema versions that produced the result.
Other CI systems
flowpact only needs Node.js and the repository files:
npx --yes flowpact check --format json --output flowpact-report.json --patch flowpact-contracts.patch