Skip to content

relgap notify ​

notify reads the JSON that digest, outdated, drift and audit print with --format json and publishes it. It never collects anything itself.

text
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 them

The 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 ​

sh
relgap notify [flags]

Flags ​

FlagDescriptionTypeDefaultValuesConfig keyNotes
--dry-run-notifyprint what would change; read with GET only and write nothingbool
--fromdigest, outdated, drift or audit JSON file (repeatable)string, repeatable
--md-max-charscut the comment to this many characters at a row or section boundaryint60000
--notifynotifiers to run: github-pr-commentlist, repeatablegithub-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 ​

CodeMeaning
0The command finished. With --fail-on, nothing matched.
1The command failed: a read, a write, a child process or a check failed.
2Wrong usage: an unknown command or flag, a bad value or argument, an invalid config file, or a prompt with no terminal.
4Credentials were missing or rejected for every source the command needed.
130Interrupted by Ctrl-C (SIGINT) or a cancelled context.

All codes are listed on the exit codes page.

Examples ​

sh
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