Skip to main content
Version: 0.4.1

kq validate in GitHub Actions

Check the model on every pull request: a workflow installs kq, runs the checks you run on your own machine, and GitHub shows each finding on the line it is about. Nothing on this page needs a license.

A workflow​

A workflow that checks the model on every pull request installs Node 24 or later and kq, then runs the checks from the repository root. Save it as .github/workflows/model.yml, with your model's path in place of models/my-model:

name: Model
on: pull_request
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm install --global @extenza-works/kanoniq-app-cli
- run: kq fmt --check models/my-model
- run: kq build --check models/my-model
- run: kq validate --format github models/my-model

A step that fails stops the job: kq fmt --check when a file is not in canonical form, kq build --check when a .g.kq file would change because a change was committed without its build, and kq validate on an error, or on a lint too with --strict. See --check gates.

What a pull request shows​

--format github writes one GitHub Actions workflow command per finding, so a pull request shows each finding on its line: an error as an error, a lint as a warning. A build error is an error too, titled with its code. The paths are relative to where kq runs, so run it from the repository root.

Say a change makes the web shop's call name the order service instead of its API, web-shop -> order-service over http auth user-token. The step writes:

::error file=models/my-model/model/my-model.kq,line=15,col=5,title=KQ022 connection-names-its-target::Connection from Component "Web Shop" (my-model/storefront/web-shop) lands on Component "Order Service" (my-model/storefront/order-service); name the Interface or Channel it uses
::warning file=models/my-model/model/my-model.g.kq,line=12,col=3,title=KQ103 orphaned-derived-element::Interface my-model/storefront/order-service/orders-api is derived but nothing names it any more; reference it or run kq prune
validated 1 model, 1 failed

and exits with 1, which stops the job. The error is KQ022; the warning is the API the call no longer names, still in the .g.kq file until the next build.

Policy findings are checked once the model has no error, and follow in a group of their own, info as a notice. A repository kq init makes checks the recommended policies, so a small model's run lists a KP001 notice in that group for each policy that has nothing to check yet. A notice doesn't fail the step.

Other formats​

--format changes how findings are written; the exit code stays the same.

FormatWrites
textOne line per finding: file, line and column, severity, code and message. The default
githubOne GitHub Actions workflow command per finding: see What a pull request shows
sarifOne SARIF 2.1.0 log on standard output, for CI systems, code-scanning viewers and AI assistants that read SARIF. A build error is a result too, under its KB code. The summary goes to standard error

For the SARIF log in GitHub's code scanning, see SARIF in code scanning.

© 2026 Extenza Works. All rights reserved.