File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -65,11 +65,20 @@ work-dir: directory in which to run govulncheck, default '.'
65
65
repo-checkout : checkout the repository, default true
66
66
check-latest : check for the latest Go version, default false
67
67
go-version-file : go.mod or go.work file specifying Go version, default ''
68
+ output-format : the format of govulncheck output ('text', 'json', or 'sarif'), default 'text'
69
+ output-file : the file to which the output is redirected, default '' (no
70
+ redirection)
68
71
```
69
72
The precedence for inputs ` go-version-input ` , ` go-version-file ` , and ` check-latest `
70
73
specifying Go version is inherited from [ actions/setup-go] ( https://github.com/actions/setup-go ) .
71
74
72
- When a vulnerability is found, an error will be displayed for that
75
+ The govulncheck-action follows the exit codes of govulncheck command.
76
+ Specifying the output format 'json' or 'sarif' will return success even if
77
+ there are some vulnerabilities detected. See
78
+ [ here] ( https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck#hdr-Exit_codes )
79
+ for more information.
80
+
81
+ When a vulnerability is found with 'text' output format, an error will be displayed for that
73
82
[ GitHub job] ( https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow )
74
83
with information about the vulnerability and how to fix it. For example:
75
84
Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ inputs:
27
27
go-version-file :
28
28
description : ' Path to the go.mod or go.work file.'
29
29
required : false
30
+ output-format :
31
+ description : ' The format of the output'
32
+ required : false
33
+ default : ' text'
34
+ output-file :
35
+ description : ' The file to which the govulncheck output is saved'
36
+ required : false
37
+ default : ' '
30
38
runs :
31
39
using : " composite"
32
40
steps :
41
49
- name : Install govulncheck
42
50
run : go install golang.org/x/vuln/cmd/govulncheck@latest
43
51
shell : bash
44
- - name : Run govulncheck
45
- run : govulncheck -C ${{ inputs.work-dir }} ${{ inputs.go-package }}
52
+ - if : inputs.output-file == ''
53
+ name : Run govulncheck
54
+ run : govulncheck -C ${{ inputs.work-dir }} -format ${{ inputs.output-format }} ${{ inputs.go-package }}
55
+ shell : bash
56
+ - if : inputs.output-file != ''
57
+ name : Run govulncheck and save to file
58
+ run : govulncheck -C ${{ inputs.work-dir }} -format ${{ inputs.output-format }} ${{ inputs.go-package }} > ${{ inputs.output-file }}
46
59
shell : bash
You can’t perform that action at this time.
0 commit comments