qusal/.github/workflows/main.yaml

63 lines
1.6 KiB
YAML
Raw Normal View History

2024-01-29 15:49:54 +00:00
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
2023-11-13 14:33:28 +00:00
#
# 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
2024-02-16 23:13:41 +00:00
- uses: actions/checkout@v4
2023-11-13 14:33:28 +00:00
with:
fetch-depth: 0
2024-02-16 23:13:41 +00:00
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1
2023-11-13 14:33:28 +00:00
- name: Lint commits
# yamllint disable-line rule:line-length
run: |
2024-01-28 22:13:24 +00:00
if test "${{ github.event_name}}" = "pull_request"
2023-11-13 14:33:28 +00:00
then
2024-01-28 22:13:24 +00:00
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
2023-11-13 14:33:28 +00:00
else
2024-01-28 22:13:24 +00:00
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}"
2023-11-13 14:33:28 +00:00
fi