forked from pact-im/go-pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (52 loc) · 1.68 KB
/
lint.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
name: Lint
on:
push:
pull_request:
workflow_dispatch:
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
- name: Set up Go
uses: actions/setup-go@v3.2.0
with:
go-version-file: .go-version
cache: true
cache-dependency-path: '**/go.sum'
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
- name: Get golangci-lint cache path
id: golangci-lint-cache-status
run: |
echo "::set-output name=dir::$(golangci-lint cache status | head -1 | sed 's/^Dir: //')"
- name: Set up golangci-lint cache
uses: actions/cache@v3.0.2
with:
key: golangci-lint-${{ runner.os }}-golangci-lint-${{ hashFiles('**/go.mod') }}
restore-keys: golangci-lint-${{ runner.os }}-golangci-lint-
path: ${{ steps.golangci-lint-cache-status.outputs.dir }}
- name: Run golangci-lint
run: |
golangci-lint run --out-format=github-actions -- \
$(go work edit -json | jq -c -r '[.Use[].DiskPath] | map_values(. + "/...")[]')
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
with:
fetch-depth: 0
- name: Create config
run: |
cat >commitlint.config.js <<EOF
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [0],
},
}
EOF
- name: Run commitlint
uses: wagoid/commitlint-github-action@v4.1.12