-
Notifications
You must be signed in to change notification settings - Fork 5
48 lines (40 loc) · 1.28 KB
/
Copy pathlint-pre-commit.yml
File metadata and controls
48 lines (40 loc) · 1.28 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
name: Pre-commit CI
on:
pull_request:
branches:
- dev
- master
jobs:
pre-commit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit
id: precommit
continue-on-error: true
shell: bash
run: |
set -o pipefail
pre-commit run --all-files --show-diff-on-failure --color=always | tee pre-commit.log
- name: Show instructions if pre-commit failed
if: steps.precommit.outcome == 'failure'
run: |
echo "❌ Pre-commit checks failed! Here are the details:"
echo "================================================"
cat pre-commit.log
echo "================================================"
echo ""
echo "💡 Please run 'pre-commit install' locally and fix the issues by running:"
echo " pre-commit run --all-files"
echo "✅ Then commit the changes and push again."
exit 1