Skip to content

Commit 4d5c79a

Browse files
authored
cli: add a "GitHub" output format (#634)
* cli: add a "GitHub" output format Closes #633. Signed-off-by: William Woodruff <william@yossarian.net> * try using SARIF path Signed-off-by: William Woodruff <william@yossarian.net> * fix lines Signed-off-by: William Woodruff <william@yossarian.net> * fmt Signed-off-by: William Woodruff <william@yossarian.net> * add --no-exit-codes Signed-off-by: William Woodruff <william@yossarian.net> * bump help snippet Signed-off-by: William Woodruff <william@yossarian.net> * bump snippet Signed-off-by: William Woodruff <william@yossarian.net> * integration test for github output Signed-off-by: William Woodruff <william@yossarian.net> * github: output tweaks * update snapshot * test-output: test GitHub output on just one file * remove columns * bump snapshot * try something else Signed-off-by: William Woodruff <william@yossarian.net> * fixup snapshot Signed-off-by: William Woodruff <william@yossarian.net> * one last hack Signed-off-by: William Woodruff <william@yossarian.net> * add primary annotation to message Signed-off-by: William Woodruff <william@yossarian.net> * usage: document --format=github, add integration docs Signed-off-by: William Woodruff <william@yossarian.net> * docs: update release notes --------- Signed-off-by: William Woodruff <william@yossarian.net>
1 parent 2f0227d commit 4d5c79a

13 files changed

Lines changed: 412 additions & 98 deletions

File tree

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test SARIF Presentation
1+
name: Test output formats
22

33
on:
44
pull_request:
@@ -46,3 +46,26 @@ jobs:
4646
repo: context.repo.repo,
4747
body: `:robot: Presentation results: <${url}>`
4848
})
49+
50+
test-github-presentation:
51+
runs-on: ubuntu-latest
52+
if: contains(github.event.pull_request.labels.*.name, 'test-github-presentation')
53+
permissions: {}
54+
55+
steps:
56+
- name: Checkout repository
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
58+
with:
59+
persist-credentials: false
60+
61+
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
62+
63+
- name: Run zizmor
64+
run: |
65+
# Normally we'd want a workflow to fail if the audit fails,
66+
# but we're only testing presentation here.
67+
cargo run \
68+
-- \
69+
--no-exit-codes \
70+
--format github \
71+
tests/integration/test-data/several-vulnerabilities.yml

docs/release-notes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ of `zizmor`.
99

1010
## Next (UNRELEASED)
1111

12+
### New Features 🌈
13+
14+
* `zizmor` now supports `--format=github` as an output format.
15+
This format produces check annotations via GitHub workflow commands,
16+
e.g. `::warning` and `::error`. See the
17+
[Output formats](./usage.md#output-formats) documentation for more information
18+
on annotations, including key limitations (#634)
19+
1220
### Improvements 🌱
1321

1422
* The SARIF output format now marks each rule as a "security" rule,

docs/snippets/help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Options:
2525
--no-progress
2626
Don't show progress bars, even if the terminal supports them
2727
--format <FORMAT>
28-
The output format to emit. By default, plain text will be emitted [default: plain] [possible values: plain, json, sarif]
28+
The output format to emit. By default, cargo-style diagnostics will be emitted [default: plain] [possible values: plain, json, sarif, github]
2929
--color <MODE>
3030
Control the use of color in output [possible values: auto, always, never]
3131
-c, --config <CONFIG>

0 commit comments

Comments
 (0)