-
Notifications
You must be signed in to change notification settings - Fork 9
62 lines (57 loc) · 1.64 KB
/
main.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
53
54
55
56
57
58
59
60
61
62
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later
---
name: Lint
# yamllint disable-line rule:truthy
on:
# yamllint disable-line rule:empty-values
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
concurrency:
group: ci-${{ github.ref }}-1
cancel-in-progress: true
jobs:
lint:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Update package list
run: sudo apt-get -y update
- name: Install OS packages
# yamllint disable-line rule:line-length
run: sudo apt-get install -y python3-dev python3-pip shellcheck reuse
# gitlint is available on Debian but Ubuntu has an older version.
- name: Install pip packages
run: pip3 install salt-lint gitlint
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- name: Lint commits
# yamllint disable-line rule:line-length
run: |
if test "${{ github.event_name}}" = "pull_request"
then
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
else
base="${{ github.event.before }}"
head="${{ github.event.after }}"
fi
if test "${base}" = "${head}" || test -z "${base}"
then
gitlint --debug --commit "${head}"
else
gitlint --debug --commits "${base}..${head}"
fi