CI/CD Workflows
Save this as .github/workflows/sovereign.yml. The job checks out the pull request, installs your dependencies, runs the Guard and keeps the SARIF report. It fails the check when the scan exits 1 (findings) or 2 (tool or config failure).
The workflow assumes the Guard is already a development dependency. Because the package is private, CI needs the same file you installed locally. In a private repository, the simplest way is to commit the tarball under vendor/ and depend on it as file:vendor/sovereign-guard-<version>.tgz.
name: sovereign
on:
pull_request:
jobs:
gate:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Run the Guard
run: npx sovereign-guard scan src --check --output-path guard-report
- name: Keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: guard-report
path: guard-reportMake GitHub block the merge
The Guard fails its check and shows the fix. It never commits anything, and it does not stop a merge by itself. GitHub decides whether a failing check blocks a merge, so the repository owner has to make the check required.
- In the repository, open Settings, then Rules, then Rulesets, and create a branch ruleset that targets your default branch.
- Turn on Require status checks to pass, and add the Guard's check. With the workflow above, that is the job named gate.
- Save the ruleset. GitHub now blocks the merge while the Guard check is red.
On private repositories, rulesets and branch protection rules need a paid GitHub plan. Without one, the Guard still fails the check and posts its result, but GitHub lets the merge go through.