forked from inclusionAI/AReaL
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.34 KB
/
pre-commit.yml
File metadata and controls
43 lines (37 loc) · 1.34 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
name: Pre-commit Checks
on: [pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit hooks
run: |
pip install pre-commit
# generate-cli-docs requires the full areal package (language: system),
# which is not installed in CI. Skip it here; it runs locally instead.
SKIP=generate-cli-docs pre-commit run --all-files
- name: Validate commit messages
run: |
pip install conventional-pre-commit
FAILED=0
for SHA in $(git log --no-merges --format=%H origin/${{ github.base_ref }}..HEAD); do
git log --format=%B -1 "$SHA" > /tmp/commit_msg
if ! conventional-pre-commit feat fix docs style refactor perf test build ci chore revert /tmp/commit_msg; then
echo "❌ Bad commit: $(git log --format=%s -1 "$SHA")"
FAILED=1
fi
done
exit $FAILED