Skip to content

Gate CI on breaking changes, EOL and vulnerabilities ​

--fail-on turns a report into a check. When a value matches, relgap still writes the report, then exits 3. This guide shows the values each command takes, how to tune them and a complete workflow.

Values per command ​

Command--fail-on values
relgap outdatedbreaking, deprecation, eol, vuln, outdated, kev
relgap auditvuln (the default), unchecked, kev
relgap digestbreaking, deprecation
relgap driftdrift

Repeat the flag or separate values with commas:

sh
relgap outdated --fail-on eol --fail-on vuln
relgap outdated --fail-on eol,vuln

A value the command doesn't check, such as --fail-on drift on outdated, exits 2. Fail-on values describes each value.

What each value counts ​

In relgap outdated, each value counts findings:

  • outdated counts the pins further behind latest than --max-behind allows.
  • breaking and deprecation count the pins whose digest from CURRENT to LATEST has such an entry at or above --min-confidence.
  • eol counts the pins whose release cycle has reached its end of life on endoflife.date.
  • vuln counts the OSV advisories that affect a pinned version, at or above --vuln-severity.
  • kev counts the advisories in the CISA Known Exploited Vulnerabilities catalog, whatever their rating. It needs --kev (config vulns.kev); without it relgap exits 2 before any request.

relgap digest counts a single digest once. With --from-mise or --all it counts each pin, and with --base or --pull-request each digest. relgap drift counts the drifted pins.

A value exits 3 once its count reaches --min-count (default 1):

sh
relgap outdated --fail-on outdated --min-count 5 --format sarif > relgap.sarif

Allow some lag ​

--fail-on outdated alone fails on any pin behind latest. --max-behind sets how far behind a pin may be:

sh
relgap outdated --fail-on outdated --max-behind minor:2
--max-behindA pin passes when
major:Nit is at most N major versions behind
minor:Nit is at most N minor versions behind
patch:Nit is at most N patch versions behind
releases:Nat most N releases came out after it
days:Nthe first release after it is at most N days old

days needs publish dates. For a tool whose versions are tags without one, relgap warns and the pin passes.

Count only serious vulnerabilities ​

--vuln-severity sets the lowest CVSS rating --fail-on vuln counts: low, medium, high or critical. An advisory whose severity is unknown counts at every threshold, since nothing says it is below one. Without the flag, every advisory counts:

sh
relgap outdated --fail-on eol --fail-on vuln --vuln-severity high

--vuln-fixable counts only the advisories with a fixed version above the pinned one, so the gate fails on what an upgrade can fix:

sh
relgap audit --vuln-fixable --vuln-severity high

EOL and vulnerabilities says where the data comes from, how the rating is read and how the fix target is chosen.

Set the policy once ​

The policy keys of the config file hold the defaults, so the workflow and a local run agree:

yaml
# .relgap.yaml
schema_version: 1
policy:
  fail_on: [eol, vuln]
  max_behind: "minor:2"
  vuln_severity: high

policy.fail_on lists values for every command, and each command uses the values it checks, so relgap drift ignores eol there. A --fail-on flag replaces the list. policy.max_behind, policy.vuln_severity, policy.vuln_fixable and policy.min_confidence are the defaults of --max-behind, --vuln-severity, --vuln-fixable and --min-confidence. Each key also has a RELGAP_POLICY_* environment variable (Configuration).

Exit codes in CI ​

CodeMeaning
0Nothing matched.
1A tool or file failed and no value matched, so the report is partial.
2Wrong usage or an invalid config file.
3A --fail-on value matched.
4Credentials were missing or refused for every source the command needed.

Exit 3 wins over exit 1: a match on partial data is still a match, and relgap logs that the report is partial. A pass on partial data proves nothing, so it exits 1. That includes an endoflife.date outage under --fail-on eol, an OSV outage under --fail-on vuln and a CISA KEV outage under --fail-on kev. Exit codes has the full table.

A workflow ​

This workflow runs once a week and on pull requests that change a pin. One relgap outdated run prints annotations, writes SARIF, Markdown and JSON with --out, and gates the job with --fail-on eol,vuln. The later steps run even when the gate fails: the Markdown goes to the step summary, the SARIF to code scanning, and relgap notify keeps one comment on the pull request. Copy it to .github/workflows/outdated.yml in a repository whose mise.toml pins relgap:

yml
# Outdated, end-of-life and vulnerable tool pins: copy this file to .github/workflows/outdated.yml
# in a repository whose mise.toml pins relgap (mise use github:sassdavid/relgap).
#
# One relgap run compares every pin, prints annotations, writes SARIF, Markdown and JSON with
# --out, and gates the job with its exit code. The later steps run even when the gate fails. On a
# pull request from a branch of this repository, relgap notify keeps one comment with the report:
# a re-run edits it only when the report changed, and a report with nothing left turns it into
# "Nothing to report". Pull requests from forks get a read-only GITHUB_TOKEN, so they get the step
# summary only.
name: outdated

on:
  schedule:
    - cron: "23 6 * * 1"
  pull_request:
    paths:
      - "mise.toml"
      - ".tool-versions"
      - "**/*.tf"
      - "**/*.hcl"
      - "**/Dockerfile"
      - ".github/workflows/*.yml"
  workflow_dispatch:

permissions: {}

concurrency:
  group: outdated-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  outdated:
    name: outdated
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
      security-events: write # SARIF upload
      pull-requests: write # the sticky comment
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
        with:
          version: 2026.11.11
      # Exit 3: a pin is end of life or has a known vulnerability. Exit 1: a source failed and no
      # gate matched. --out writes every file before the exit code is set.
      - name: relgap outdated
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          relgap outdated --format github --out sarif=outdated.sarif --out md=outdated.md \
            --out json=outdated.json --fail-on eol,vuln
      - name: step summary
        if: ${{ !cancelled() && hashFiles('outdated.md') != '' }}
        run: cat outdated.md >> "$GITHUB_STEP_SUMMARY"
      - uses: github/codeql-action/upload-sarif@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
        if: ${{ !cancelled() && hashFiles('outdated.sarif') != '' }}
        with:
          sarif_file: outdated.sarif
          category: relgap-outdated
      - name: pull request comment
        if: >-
          ${{ !cancelled() && hashFiles('outdated.json') != '' && github.event_name == 'pull_request' &&
          github.event.pull_request.head.repo.full_name == github.repository }}
        env:
          GH_TOKEN: ${{ github.token }}
        run: relgap notify --from outdated.json --notify github-pr-comment

--out writes every file before the exit code is set, so the steps after the gate always find them. Upload SARIF to code scanning explains the upload, and Use relgap-action does the same without a mise.toml entry.