mirror of
https://gitea.com/actions/govulncheck-action.git
synced 2026-12-05 19:01:55 +00:00
The go-version-input input defaults to "stable", which actions/setup-go prefers over go-version-file. This makes go-version-file a no-op unless go-version-input is first set to "". Default go-version-input to "" instead, and fall back to "stable" later if neither go-version-input nor go-version-file is set. Change-Id: I1d3d5abc83686e96078d7faaf1472d8713f3974e GitHub-Last-Rev: 2ad299b5e83c081a26956f9689c558feb90cdcae GitHub-Pull-Request: golang/govulncheck-action#15 Reviewed-on: https://go-review.googlesource.com/c/govulncheck-action/+/862401 Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: David Chase <drchase@google.com> TryBot-Bypass: Sean Liao <sean@liao.dev> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
79 lines
2.8 KiB
YAML
79 lines
2.8 KiB
YAML
name: 'golang-govulncheck-action'
|
|
description: 'Run govulncheck'
|
|
inputs:
|
|
go-version-input: # version of Go to use for govulncheck
|
|
description: 'Version of Go to use for govulncheck'
|
|
required: false
|
|
default: ''
|
|
check-latest:
|
|
description: 'Set this option to true if you want the action to always check for the latest available Go version that satisfies the version spec'
|
|
required: false
|
|
default: true
|
|
cache:
|
|
description: 'Used to specify whether Go caching is needed. Set to true, if you would like to enable caching.'
|
|
required: false
|
|
default: true
|
|
cache-dependency-path:
|
|
description: 'Used to specify the path to a dependency file (for monorepos) - go.sum'
|
|
required: false
|
|
default: ''
|
|
go-package:
|
|
description: 'Go Package to scan with govulncheck'
|
|
required: false
|
|
default: './...'
|
|
work-dir:
|
|
description: 'Directory in which to run govulncheck'
|
|
required: false
|
|
default: '.'
|
|
repo-checkout:
|
|
description: "Checkout the repository"
|
|
required: false
|
|
default: true
|
|
go-version-file:
|
|
description: 'Path to the go.mod or go.work file.'
|
|
required: false
|
|
output-format:
|
|
description: 'The format of the output'
|
|
required: false
|
|
default: 'text'
|
|
output-file:
|
|
description: 'The file to which the govulncheck output is saved'
|
|
required: false
|
|
default: ''
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- if: inputs.repo-checkout != 'false' # only explicit false prevents repo checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
|
|
with:
|
|
# go-version overrides go-version-file, so only default to stable without it
|
|
go-version: ${{ inputs.go-version-input || (inputs.go-version-file == '' && 'stable' || '') }}
|
|
check-latest: ${{ inputs.check-latest }}
|
|
go-version-file: ${{ inputs.go-version-file }}
|
|
cache: ${{ inputs.cache }}
|
|
cache-dependency-path: ${{ inputs.cache-dependency-path }}
|
|
- name: Install govulncheck
|
|
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
|
shell: bash
|
|
env:
|
|
GOOS: ''
|
|
GOARCH: ''
|
|
- if: inputs.output-file == ''
|
|
name: Run govulncheck
|
|
run: govulncheck -C "$WORK_DIR" -format "$OUTPUT_FORMAT" "$GO_PACKAGE"
|
|
shell: bash
|
|
env:
|
|
WORK_DIR: ${{ inputs.work-dir }}
|
|
OUTPUT_FORMAT: ${{ inputs.output-format }}
|
|
GO_PACKAGE: ${{ inputs.go-package }}
|
|
- if: inputs.output-file != ''
|
|
name: Run govulncheck and save to file
|
|
run: govulncheck -C "$WORK_DIR" -format "$OUTPUT_FORMAT" "$GO_PACKAGE" > "$OUTPUT_FILE"
|
|
shell: bash
|
|
env:
|
|
WORK_DIR: ${{ inputs.work-dir }}
|
|
OUTPUT_FORMAT: ${{ inputs.output-format }}
|
|
GO_PACKAGE: ${{ inputs.go-package }}
|
|
OUTPUT_FILE: ${{ inputs.output-file }}
|