-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
50 lines (50 loc) · 1.59 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: "golang-deadcode-action"
description: "Run deadcode"
inputs:
repo-checkout:
description: "Checkout the repository"
required: false
default: true
go-version:
description: "Version of Go to use for deadcode"
required: false
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: false
go-version-file:
description: "Path to the go.mod or go.work file."
required: false
cache:
description: "Used to specify whether Go caching is needed. Set to true, if you would like to enable caching."
required: false
default: true
flags:
description: "Flags to run with deadcode"
required: false
go-package:
description: "Go package to scan with deadcode"
required: false
default: "./..."
runs:
using: "composite"
steps:
- if: inputs.repo-checkout != 'false' # only explicit false prevents repo checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
check-latest: ${{ inputs.check-latest }}
go-version-file: ${{ inputs.go-version-file }}
cache: ${{ inputs.cache }}
- name: Install deadcode
run: go install golang.org/x/tools/cmd/deadcode@latest
shell: bash
- name: Run deadcode
run: |
out="$(deadcode ${{ inputs.flags }} ${{ inputs.go-package }})"
if [[ -n "$out" ]] && [[ "$out" != "null" ]]; then
echo "$out" >&2
exit 1
fi
shell: bash