Integrate APX into your continuous integration pipeline for automated semantic governance. Gate PRs, surface violations, and maintain audit trails.
Add APX to your GitHub workflow in 3 steps. The action runs checks on every PR and posts results as comments.
name: APX Semantic Check
on:
pull_request:
types: [opened, synchronize]
jobs:
apx-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run APX Check
uses: apx-labs/apx-action@v0
with:
policy: 'strict-k8s'
json-output: true
- name: Upload APX Results
uses: actions/upload-artifact@v3
with:
name: apx-results
path: |
check.core.json
check.receipt.json
check.health.jsonAll constraints satisfied. PR can merge safely.
Soft constraints failed. Review needed but not blocked.
Hard constraints or blockers failed. Merge prevented.
APX automatically posts structured comments on pull requests. Use this template to customize the format or integrate with your own CI system.
APX Check Result: {{DECISION}} (policy: {{POLICY_NAME}})
- Hard failures: {{HARD_IDS or "none"}}
- Soft failures: {{SOFT_IDS or "none"}} {{SOFT_MARGINS}}
- Blockers (infra/external): {{BLOCKER_IDS or "none"}}
Details:
- Core JSON: {{LINK_TO_CHECK_CORE_JSON}}
- Receipt (audit): {{LINK_TO_CHECK_RECEIPT_JSON}}
- Health: {{LINK_TO_CHECK_HEALTH_JSON}}
{{#if BLOCKERS}}
⚠️ APX blocked: infra/external blockers [{{BLOCKER_IDS}}] — cannot satisfy policy safely; fix blockers and rerun.
Reason: constraint requires external/infra capability; search halted (no approximation).
Next steps: address listed blockers (e.g., enable HSM/KMS, configure DEA gateway), then rerun.
See [Why APX Blocks](/docs#why-blocks) for details on resolving infra/external constraints.
{{/if}}
{{#if HARD_FAILURES}}
⚠️ Hard constraints failed: [{{HARD_IDS}}]
Details: see check.core.json for margins/locations; see check.receipt.json for audit trail.
{{/if}}
{{#if SOFT_FAILURES}}
⚠️ Soft constraints failed: [{{SOFT_IDS}}]
Proceeding, but debt increased; see core/health JSON for details.
{{/if}}$ apx check --json --policy strict-hipaa 🔍 APX Check (policy: strict-hipaa) ├─ Evaluating 47 constraints... ├─ ✓ 42 passed ├─ ⚠ 2 soft failures ├─ ✗ 1 hard failure └─ 🚫 2 infra/external blockers ❌ BLOCK: infra/external blockers detected → [KMS-AES256-1, HSM-FIPS-2] Reason: constraint requires external/infra capability; search halted (no approximation). Next steps: address listed blockers (e.g., enable HSM/KMS, configure DEA gateway), then rerun. See check.core.json for details.
$ apx check --json --policy strict-k8s 🔍 APX Check (policy: strict-k8s) ├─ Evaluating 32 constraints... ├─ ✓ 28 passed ├─ ✗ 4 hard failures └─ 🚫 0 blockers ⚠️ WARN/BLOCK: hard constraints failed → [PDB-MIN-1, HPA-SCALE-2, NET-POL-3, RBAC-NS-1] Details: see check.core.json for margins/locations; see check.receipt.json for audit trail. Search continues; fix constraints and rerun.
$ apx check --json --policy permissive 🔍 APX Check (policy: permissive) ├─ Evaluating 18 constraints... ├─ ✓ 15 passed ├─ ⚠ 3 soft failures └─ 🚫 0 blockers ⚠️ WARN: soft constraints failed → [LOG-FMT-1, METRIC-TAG-2, DOC-COVER-3] Proceeding, but debt increased; see core/health JSON for details.
APX Check Result: BLOCK (policy: strict-hipaa)
Details:
⚠️ APX blocked: infra/external blockers [KMS-AES256-1, HSM-FIPS-2] — cannot satisfy policy safely; fix blockers and rerun.
Reason: constraint requires external/infra capability; search halted (no approximation).
Next steps: address listed blockers (e.g., enable HSM/KMS, configure DEA gateway), then rerun.
See "Why APX Blocks" for details on resolving infra/external constraints →
APX Check Result: WARN (policy: strict-k8s)
Details:
⚠️ Hard constraints failed: [PDB-MIN-1, HPA-SCALE-2]
Details: see check.core.json for margins/locations; see check.receipt.json for audit trail.
apx-check:
stage: test
script:
- npm install -g @apx/cli
- apx check --json --policy strict-k8s
artifacts:
paths:
- check.*.jsonUse the APX CLI with GitLab's native artifact system
stage('APX Check') {
steps {
sh 'npm install -g @apx/cli'
sh 'apx check --json'
archiveArtifacts 'check.*.json'
}
}Install CLI and run checks in your Jenkinsfile
- run:
name: APX Check
command: |
npm install -g @apx/cli
apx check --json
- store_artifacts:
path: check.core.jsonAdd APX to your CircleCI workflow config
- script: |
npm install -g @apx/cli
apx check --json
displayName: 'APX Check'
- publish: $(Build.SourcesDirectory)
artifact: apx-resultsIntegrate with Azure DevOps pipelines