-
Notifications
You must be signed in to change notification settings - Fork 4
36 lines (31 loc) · 1.11 KB
/
pre-commit.yaml
File metadata and controls
36 lines (31 loc) · 1.11 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
---
# https://pre-commit.com
# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file.
name: pre-commit
on:
pull_request:
push:
branches: [main]
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1
conventional-commits:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for commit comparison
- name: Fetch main branch ref (not available in PR context)
run: git fetch origin main:main
- name: Lint all commit messages within the PR
run: |
python -m pip install --upgrade pip
pip install git+https://gitlab.ethz.ch/sis/tools/conventional-commit-lint.git@0.9.0
git log --pretty="commit %h%n%B%x00" --no-merges ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | conventional-commit-lint