-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.17 KB
/
pre-commit.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
name: pre-commit
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
main:
name: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check if repo has .pre-commit-config.yaml
id: has_pre_commit_config_file
uses: andstor/file-existence-action@v2
with:
files: '.pre-commit-config.yaml'
- name: Check if repo has .tool-versions
id: has_tool_versions_file
uses: andstor/file-existence-action@v2
with:
files: '.tool-versions'
- name: Install golang
uses: actions/setup-go@v4
with:
go-version: '>=1.20.0'
- run: go version
- name: Install pre-commit prerequisites
if: steps.has_pre_commit_config_file.outputs.files_exists == 'true'
uses: asdf-vm/actions/install@v2
with:
tool_versions: |
golangci-lint 1.51.2
shellcheck 0.8.0
shfmt 3.5.1
- name: Run pre-commit
if: steps.has_pre_commit_config_file.outputs.files_exists == 'true'
uses: pre-commit/action@v3.0.0
env:
SKIP: >-
no-commit-to-branch,
go-imports