-
-
Notifications
You must be signed in to change notification settings - Fork 166
105 lines (90 loc) · 2.85 KB
/
Copy pathlint.yml
File metadata and controls
105 lines (90 loc) · 2.85 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: PR Lint
on:
pull_request:
jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check for Go changes
id: changes
run: |
FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD -- '*.go' 'go.mod' 'go.sum')
if [ -z "$FILES" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Go
if: steps.changes.outputs.skip != 'true'
uses: actions/setup-go@v7
with:
go-version: 'stable'
- name: Set up Node
if: steps.changes.outputs.skip != 'true'
uses: actions/setup-node@v7.0.0
with:
node-version: latest
- name: Build SPA
if: steps.changes.outputs.skip != 'true'
run: npm ci && sh webui/build.sh
- name: Run golangci-lint
if: steps.changes.outputs.skip != 'true'
uses: golangci/golangci-lint-action@v9.3.0
npm-format:
name: NPM formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check for NPM-related changes
id: changes
run: |
FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD -- 'webui/**' 'package.json' 'package-lock.json' 'prettier.config.js')
if [ -z "$FILES" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Node
if: steps.changes.outputs.skip != 'true'
uses: actions/setup-node@v7.0.0
with:
node-version: latest
- name: Install dependencies
if: steps.changes.outputs.skip != 'true'
run: npm ci
- name: Run format
if: steps.changes.outputs.skip != 'true'
run: npm run format
- name: Check for formatting changes
if: steps.changes.outputs.skip != 'true'
run: |
if [ -n "$(git diff)" ]; then
echo "::error::NPM files are not formatted. Run 'npm run format' locally"
git diff
exit 1
fi
no-merge-commits:
name: No merge commits
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Check for merge commits
run: |
MERGE_COMMITS=$(git log --merges --oneline origin/${{ github.base_ref }}..HEAD)
if [ -n "$MERGE_COMMITS" ]; then
echo "::error::PR contains merge commits. Please rebase instead of merging"
echo "$MERGE_COMMITS"
exit 1
fi