Skip to main content
GitHub Actions is GitHub’s built-in way to run automated checks, often called CI, each time you push code or update a pull request. Adding Iris Code to it checks every change against the same standards you use in your editor. The result appears in GitHub, where reviewers can see which limits passed or failed and which lines caused a problem.

The workflow

Add this file at .github/workflows/iris.yml:
The action installs the Iris Code CLI (the command-line tool) and runs iris gate . --format github. Because the file names @v1, fixes to how the action runs the CLI reach you without editing anything.
Add IRIS_LICENCE_TOKEN under Settings → Secrets and variables → Actions. Scanning a whole directory needs Pro.Without a token the step runs as Free and skips the directory check instead of failing. A missing secret therefore never fails your build for the wrong reason.

Inputs

The action also sets an exit-code output, using the codes in the exit codes table below. There is deliberately no general threshold input. Your limits live in .irisconfig.json, which is committed and can be reviewed like any other change. A workflow setting that quietly overrode them would defeat the point of having them written down. For the same reason, command: gate refuses min-score rather than accepting it and checking something you did not ask for. min-score only applies to command: check, where the CLI supports --min-score.

Running the CLI directly

The action is a convenience around the CLI. If you would rather see the exact commands, or choose your own CLI version, run it yourself:
The editor command Iris Code: Add GitHub Actions Workflow writes this version of the file for you, filled in with your current threshold.

Requiring a passing check before merge

A failed workflow reports a problem, but on its own it does not stop anyone merging. To make GitHub refuse the merge, add the Iris Code job as a required status check in a branch protection rule or ruleset for your main branch. Run the workflow once first, so GitHub has the check to list. See GitHub’s required status checks guide. Use the job name shown in your workflow, such as iris in the example above.

Configuring the threshold

A .irisconfig.json at your project root:
No config file means a threshold of 70.

Annotations on the diff

--format github makes each finding appear on the pull request itself, marked in red on the exact line, so reviewers do not have to search the run’s log. It also writes a pass/fail table into the run’s job summary. It works with iris check as well as iris gate.

Saving a machine-readable report

To keep a JSON report that other tools can read, whether the gate passed or failed, add two steps after the gate:
if: always() makes the steps run even after the gate fails, which is when the report is most useful.

Slack notifications

Add an IRIS_SLACK_WEBHOOK secret and a failed gate is also posted to a Slack channel. See Slack notifications.

Exit codes

Exit code 3 is not a gate failure. It means Iris Code could not confirm your licence, because the licence server was unreachable or was turning away too many repeated requests. Rather than report a pass it never checked, the gate stops there. Retry the job; your code is not the problem. A repository with no Pro licence at all is a different case and still exits 0.
Not on GitHub? Iris Code: Add CI Pipeline Snippet generates the equivalent for GitLab CI, Bitbucket Pipelines, an npm script, or a plain shell step. Findings marked on the changed lines are GitHub-only; elsewhere the exit code decides whether the job passes.