Skip to content

Use relgap-action ​

relgap-action is a composite GitHub Action. It installs a relgap release, checks it before it runs, and can run relgap for you. The repository then needs no mise.toml entry for relgap. It runs on Linux, macOS and Windows runners.

Modes ​

The mode input picks what the step does:

  • install (the default) puts relgap on PATH. Later steps call it as they would any tool.
  • report runs relgap outdated (or relgap drift with command: drift) once. It writes JSON, Markdown, SARIF and annotations, uploads the SARIF to code scanning and appends the Markdown to the step summary.
  • comment runs relgap digest --pull-request on a pull_request event and keeps one comment with the digest on the pull request, as Comment upgrade notes on Renovate pull requests describes.

In report and comment mode, fail-on passes --fail-on values, separated by commas or newlines. A match fails the step with exit 3 after the files, the upload and the comment are done. args adds more arguments, one per line.

A workflow ​

This workflow runs relgap outdated on pushes to main and every Monday, and the digest on pull requests that change a pin. Copy it to .github/workflows/relgap.yml:

yml
# relgap through relgap-action: copy this file to .github/workflows/relgap.yml. The action installs
# a verified relgap release, so the repository needs no mise.toml entry for relgap.
#
# The outdated job runs relgap outdated, uploads the SARIF to code scanning, appends the Markdown
# to the step summary, and fails on an end-of-life or vulnerable pin. The digest job runs on pull
# requests that change a pin and keeps one comment with the release notes of each upgraded tool.
# Pull requests from forks and from Dependabot get a read-only GITHUB_TOKEN, so they get the step
# summary only.
name: relgap

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

permissions: {}

jobs:
  outdated:
    if: ${{ github.event_name != 'pull_request' }}
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
      security-events: write # the SARIF upload
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: sassdavid/relgap-action@518ce61cef05d84d2bd980c553bd24fdca9ed0c7 # v1.2.0
        with:
          mode: report
          fail-on: eol, vuln

  digest:
    if: ${{ github.event_name == 'pull_request' }}
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
      pull-requests: write # the comment
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 0 # relgap reads the pins at the base commit
          persist-credentials: false
      - uses: sassdavid/relgap-action@518ce61cef05d84d2bd980c553bd24fdca9ed0c7 # v1.2.0
        with:
          mode: comment

The outdated job needs security-events: write for the SARIF upload, and the digest job needs pull-requests: write for the comment and fetch-depth: 0 so relgap can read the pins at the base commit. Pull requests from forks and from Dependabot get a read-only GITHUB_TOKEN, so they get the step summary only.

Verification ​

The action checks every archive against the release's checksums.txt (sha256), then runs the check that verify names:

  • attestation (the default) runs gh attestation verify, pinned to relgap's release workflow.
  • cosign runs cosign verify-blob on checksums.txt and needs cosign or mise on PATH.
  • checksum stops after sha256. It catches a broken download, not a replaced release.

Security and verification shows the same checks for a manual install.

Inputs and outputs ​

From action.yml of sassdavid/relgap-action v1.2.0.

Inputs ​

InputDefaultDescription
versionrelgap version to install (X.Y.Z, vX.Y.Z or latest). Empty installs the version this action release pins in scripts/tool.env.
verifyattestationThe check after sha256 against checksums.txt. attestation runs gh attestation verify, pinned to relgap's release workflow. cosign runs cosign verify-blob on checksums.txt and needs cosign or mise on PATH. checksum adds nothing.
modeinstallinstall puts relgap on PATH. report runs the command once, writes JSON, Markdown, SARIF and annotations, uploads the SARIF and writes the step summary. comment does the same on a pull_request event and keeps one comment on the pull request.
commandThe command that report and comment mode run. Empty runs the first one scripts/tool.env lists for the mode.
argsMore arguments for the command, one per line.
fromA directory of results from an earlier step, passed with the flag that scripts/tool.env names. Only a tool that sets that flag takes it; see the README.
fail-onValues for --fail-on, separated by commas or newlines. A match exits 3 and fails the step after the files, the SARIF upload and the comment.
sariftrueUpload the SARIF file to code scanning (true or false). The job needs security-events write.
step-summarytrueAppend the Markdown report to the step summary (true or false).
github-token${{ github.token }}Token for gh attestation verify, the GitHub API calls of relgap, the SARIF upload and the pull request comment.
working-directory.Directory the command runs in. SARIF locations are relative to it.

Outputs ​

OutputDescription
versionThe installed relgap version, without a leading v.
pathAbsolute path of the relgap binary.
exit-codeExit code of the command in report and comment mode (0, 1, 2, 3 or 4).
json-fileAbsolute path of the JSON report; empty when the command wrote none.
sarif-fileAbsolute path of the SARIF file; empty when the command writes no SARIF.
md-fileAbsolute path of the Markdown report; empty when the command wrote none.

The exit-code output lets a later step act on the result, for example exit 3 for a matched gate. Exit codes lists every code.