-
Notifications
You must be signed in to change notification settings - Fork 2
38 lines (36 loc) · 1.24 KB
/
pre-commit.yml
File metadata and controls
38 lines (36 loc) · 1.24 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
name: pre-commit
# Each consolidated sub-project keeps its own .pre-commit-config.yaml. Run
# pre-commit per project, scoped to ONLY that project's files (via git ls-files
# of the project path), so one project's hooks never run over another's files.
# This matters because the python project's check-yaml/black would otherwise
# choke on the Helm templates and reformat unrelated code repo-wide.
on:
pull_request:
push:
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- core
- docker
- deployment
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install pre-commit
- name: Run pre-commit for ${{ matrix.project }}
shell: bash
run: |
if [ -z "$(git ls-files -- '${{ matrix.project }}/')" ]; then
echo "No tracked files under ${{ matrix.project }}/ — nothing to check."
exit 0
fi
git ls-files -z -- '${{ matrix.project }}/' | xargs -0 pre-commit run \
--config '${{ matrix.project }}/.pre-commit-config.yaml' \
--show-diff-on-failure --files