Skip to main content
CodeGate integrates with GitHub Actions through SARIF output and exit codes. Scanning in CI surfaces risks that live in repository-controlled files—MCP configs, hooks, workflows, rule markdown—before they reach production environments.

Setting up the integration

1

Install CodeGate in your workflow

Add a step to install CodeGate globally before running the scan. Because CodeGate is published to npm, no additional authentication or registry configuration is required.
2

Run the scan with --no-tui

Use --no-tui to disable the interactive terminal UI and interactive prompts. This flag is required in CI because there is no TTY and no user available to respond to prompts.
--format sarif produces a SARIF 2.1.0 report that GitHub Code Scanning can ingest directly. --output writes the report to a file instead of stdout.
3

Upload the SARIF report to GitHub Code Scanning

Use the github/codeql-action/upload-sarif action to publish findings to the Security tab of your repository. Findings appear as code scanning alerts and can be tracked over time.

Complete workflow examples

Workflow audit integration

The --workflow-audits flag enables the CI/CD audit pack, which scans GitHub Actions workflows, action definitions, and Dependabot configuration for risks that a standard file scan does not cover.
Workflow audit checks include:
  • Unpinned external action references (uses: owner/repo@tag instead of a commit SHA)
  • High-risk triggers (pull_request_target, workflow_run)
  • Overly broad permissions (write-all and explicit write grants)
  • Template expression injection patterns in run steps and known sink inputs
  • Known vulnerable action references (requires --runtime-mode online)
  • Dependabot cooldown and execution-risk checks
  • Workflow hygiene issues such as missing concurrency gates, obfuscation, and unsafe conditional trust
Restrict the audit to specific artifact kinds with --collect-kind:

Exit code handling in CI

CodeGate exits with a code that reflects the scan result. Use exit codes to decide whether a job should pass or fail. Treat exit code 2 as a blocking condition. GitHub Actions stops the job when any step exits with a non-zero code, so a codegate scan step that exits 2 fails the job automatically. To distinguish between “findings below threshold” (exit code 1) and “findings at or above threshold” (exit code 2) in shell logic:
See Exit codes for the full reference.

Using —format json for pipeline consumption

Use --format json when you want to process findings programmatically in your pipeline rather than uploading SARIF to GitHub Code Scanning.

Tips for CI environments

Always pass --no-tui in CI. Without it, CodeGate may attempt to render an interactive terminal UI or pause for user input, which hangs the job.
Use --strict-collection to treat workflow parse failures as high-severity findings. This prevents malformed workflow files from silently escaping audit coverage.
The security-events: write permission is required on the GitHub Actions job to upload SARIF results to Code Scanning. Without it, the upload step will fail.
Deep scan (--deep) is interactive by default and will hang in non-interactive CI environments unless --force is also provided. Avoid --deep in CI unless you have explicitly reviewed its behavior and accepted the additional exposure from remote metadata fetching.