-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (48 loc) · 1.35 KB
/
lint.yaml
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
name: Lint
on:
workflow_call:
inputs:
enable_pr_comment:
description: 'Enable PR comment'
required: false
default: true
type: 'boolean'
permissions:
contents: read
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Use golang
uses: actions/setup-go@v5
with:
go-version: "1.23.x"
- name: Install ruleguard
run: go install -v github.com/quasilyte/go-ruleguard/cmd/ruleguard@latest
- id: lint
name: Run linter
continue-on-error: true
run: |
cat <<EOF > result.json
$(./run_lint.sh)
EOF
- name: Create comment file
if: ${{ inputs.enable_pr_comment == true }}
run: |
cat << EOF > comment.md
Hello I'm Potetobot : ).
Thank you for your contribution.
Linting results are as follows (if none, it means no issues were found):
\`\`\`json
$(ruleguard -json -rules ./rules/linter.go ./...)
\`\`\`
EOF
- name: Create PR comment
if: ${{ inputs.enable_pr_comment == true }}
run: |
gh pr comment ${{ github.event.number }} --body-file comment.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}