-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (44 loc) · 1.53 KB
/
lint.yml
File metadata and controls
50 lines (44 loc) · 1.53 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
name: Lint
on:
push:
pull_request:
jobs:
lint:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Commit message convention check
if: ${{ !(startsWith(github.head_ref, 'dependabot/') || startsWith(github.ref_name, 'dependabot/')) }}
run: |
python -m pip install --upgrade pip commitizen
if [ "${{ github.event_name }}" = "pull_request" ]; then
RANGE="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
else
BEFORE="${{ github.event.before }}"
AFTER="${{ github.sha }}"
if [ -n "${BEFORE}" ] && [ "${BEFORE}" != "0000000000000000000000000000000000000000" ] && git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then
RANGE="${BEFORE}..${AFTER}"
elif git rev-parse --verify "${AFTER}^" >/dev/null 2>&1; then
RANGE="${AFTER}^..${AFTER}"
else
RANGE="${AFTER}..${AFTER}"
fi
fi
echo "Checking commit messages in range: ${RANGE}"
cz check --rev-range "${RANGE}"
- name: Check linter configuration
run: make lint-config
- name: Run linter
run: make lint