relgap notify
notify reads the JSON that digest, outdated, drift and audit print with --format json and publishes it. It never collects anything itself.
github-pr-comment one comment per report kind on a GitHub pull request, edited in place. The
repository comes from GITHUB_REPOSITORY and the pull request from the
GITHUB_EVENT_PATH event, as GitHub Actions sets themThe comment starts with a hidden marker that names the report kind and a hash of the comment, so a re-run edits its own comment and writes nothing when the hash is the same. A report with nothing to report turns an existing comment into "Nothing to report" and creates none. Markdown longer than --md-max-chars is cut at a row or section boundary.
A digest has something to report when it covers a tool, an outdated report when a pin is outdated, end of life, vulnerable or failed, and a drift report when a tool drifts or failed. An audit report has something to report when it has a finding, an error, or a pin left unchecked for the reason failed, offline or unresolved. A pin no advisory source covers, such as an image or a chart, doesn't count.
The token comes from GH_TOKEN, GITHUB_TOKEN or gh, as for digest. It needs pull-requests: write. --dry-run-notify reads the comments with GET requests and prints what would change.
Exit codes: 0 when every comment was published, 4 when GitHub refused the token, 2 when the repository or the pull request is unknown, and 1 for any other failure.
Usage
relgap notify [flags]Flags
| Flag | Description | Type | Default | Values | Config key | Notes |
|---|---|---|---|---|---|---|
--dry-run-notify | print what would change; read with GET only and write nothing | bool | ||||
--from | digest, outdated, drift or audit JSON file (repeatable) | string, repeatable | ||||
--md-max-chars | cut the comment to this many characters at a row or section boundary | int | 60000 | |||
--notify | notifiers to run: github-pr-comment | list, repeatable | github-pr-comment: one comment per report on a GitHub pull request |
The global flags work with every command.
Output formats
--format accepts tty, plain, json. Without it, the format is tty when stdout is a terminal and plain otherwise. Formats are described on the global flags page.
Exit codes
| Code | Meaning |
|---|---|
| 0 | The command finished. With --fail-on, nothing matched. |
| 1 | The command failed: a read, a write, a child process or a check failed. |
| 2 | Wrong usage: an unknown command or flag, a bad value or argument, an invalid config file, or a prompt with no terminal. |
| 4 | Credentials were missing or rejected for every source the command needed. |
| 130 | Interrupted by Ctrl-C (SIGINT) or a cancelled context. |
All codes are listed on the exit codes page.
Examples
relgap outdated --format json > outdated.json
relgap notify --from outdated.json --notify github-pr-comment
relgap audit --fail-on= --format json > audit.json
relgap notify --from audit.json --notify github-pr-comment
relgap notify --from digest.json --from drift.json --notify github-pr-comment --dry-run-notify