Design review in CI
The CI templates run a Prism design review on every pull request (GitHub) or merge request (GitLab). Each run syncs the project, compares the base and head commits, exports the head’s BOM, and keeps comparison.json and bom.csv as build artifacts.
Before you start
Section titled “Before you start”- The KiCad repository is registered as a project in Prism. Note the project id Prism shows for it.
- Prism is reachable from your CI runners.
- You have a personal access token with
api:readanddesign:write. Addcomments:writeif your job will also post comments. Create it for an account whose role can sync the project (designer or admin).
GitHub Actions
Section titled “GitHub Actions”- Copy
examples/ci/github-actions/prism-design-review.ymlfrom the Prism repository to.github/workflows/prism-design-review.ymlin your KiCad repository. - In the repository’s Settings → Secrets and variables → Actions, add the variable
PRISM_URLwith your Prism address, for examplehttps://prism.example.com. - Add the variable
PRISM_PROJECTwith the project id. - Add the secret
PRISM_TOKENwith the token. - In the workflow, set
PRISM_SDK_REFto a Prism release tag or a full commit sha. The template usesmain, which can change between runs. - Open a pull request. The Prism design review workflow runs and uploads the
prism-design-reviewartifact.
The workflow checks out the repository with fetch-depth: 0, because the comparison needs both the base and the head commit.
GitLab CI
Section titled “GitLab CI”- Copy
examples/ci/gitlab/prism-design-review.gitlab-ci.ymlfrom the Prism repository into your KiCad repository, and include it from.gitlab-ci.ymlor use it as your.gitlab-ci.yml. - Under Settings → CI/CD → Variables, add
PRISM_URLandPRISM_PROJECT. - Add
PRISM_TOKENas a masked variable. - Set
PRISM_SDK_REFin the file to a Prism release tag or a full commit sha. - Open a merge request. The
prism-design-reviewjob runs in thedesign-reviewstage and keeps the artifacts even when it fails.
The job runs only for merge request pipelines. It compares CI_MERGE_REQUEST_DIFF_BASE_SHA with CI_COMMIT_SHA.
What each step does
Section titled “What each step does”Both templates install the Python SDK and CLI and run three commands:
prism sync "$PRISM_PROJECT" --waitprism compare "$PRISM_PROJECT" "$BASE_SHA" "$HEAD_SHA" --wait --json > comparison.jsonprism bom "$PRISM_PROJECT" --revision "$HEAD_SHA" --csv > bom.csvprism sync --waitfetches the new commits into Prism and fails the job if the sync fails.prism compare --wait --jsonwaits for the comparison and writes{"jobId": ..., "reviews": {"schematic": ..., "pcb": ...}}. Each review lists itsgroups, each with akind,impact,title,summaryand thereferencesit touches. The step fails if the comparison fails.prism bom --csvwrites the head’s engineering BOM.
The templates don’t post anything to the pull request and don’t block a merge on their own.
Example: fail on electrical changes
Section titled “Example: fail on electrical changes”To make a reviewer look at every electrical change, add a step after the comparison that fails when one is present:
python - <<'EOF'import jsonimport sys
reviews = json.load(open("comparison.json"))["reviews"]groups = [ (domain, group["title"]) for domain, review in reviews.items() for group in review.get("groups", []) if group["impact"] == "electrical"]for domain, title in groups: print(f"{domain}: {title}")sys.exit(1 if groups else 0)EOFThe impacts are mechanical, fabrication, electrical, assembly, constraints and documentation.
Example: comment on changed parts
Section titled “Example: comment on changed parts”With comments:write on the token, a step can leave a review comment in Prism on each changed component, so reviewers find them in the viewer. See Example: comment on every changed part.
Get notified instead of polling
Section titled “Get notified instead of polling”To start other work when a comparison finishes, without a CI job waiting on it, subscribe to comparison.done with a webhook.