forked from Jerome1337/golint-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
61 lines (52 loc) · 1.29 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
51
52
53
54
55
56
57
58
59
60
61
name: golintr
author: norwd
description: "Lint your code using golint"
branding:
icon: check-circle
color: green
inputs:
path:
description: 'Path used by golint command'
required: false
default: './...'
outputs:
errors:
description: 'The golint output if the command fail'
value: ${{ steps.golint.outputs.errors }}
runs:
using: composite
steps:
- id: install
name: "Install `golint`"
shell: bash
run: go install golang.org/x/lint/golint@latest
- id: golint
name: "Run `golint`"
shell: bash
env:
GOLINT_PATH: ${{ inputs.path }}
run: |
{
echo "errors<<EOF"
~/go/bin/golint -set_exit_status "${GOLINT_PATH}" || true
echo "EOF"
} >> "${GITHUB_OUTPUT}"
- if: steps.golint.outputs.errors != ''
name: "Display Errors"
uses: norwd/grawk@v1
with:
input: ${{ steps.golint.outputs.errors }}
program: |
{
file=$1
line=$2
title="Go Lint Error"
$1=""
$2=""
$3=""
print "::error file=" file ",line=" line ",title=" title "::" $0
}
- if: steps.golint.outputs.errors != ''
name: "Exit With Error Code 1"
shell: bash
run: exit 1