Skip to content

Commit 41b01e5

Browse files
authored
[CI] Unify pre-commit job (learning-process#577)
Fully get rid of supplementary jobs and hold them under pre-commit umbrella
1 parent ff2e4fb commit 41b01e5

File tree

3 files changed

+10
-43
lines changed

3 files changed

+10
-43
lines changed

.github/workflows/cpp-lint.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ concurrency:
1616
!startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
1717
1818
jobs:
19-
cpp-lint:
20-
uses: ./.github/workflows/cpp-lint.yml
19+
pre-commit:
20+
uses: ./.github/workflows/pre-commit.yml
2121
ubuntu:
2222
needs:
23-
- cpp-lint
23+
- pre-commit
2424
uses: ./.github/workflows/ubuntu.yml
2525
mac:
2626
needs:
27-
- cpp-lint
27+
- pre-commit
2828
uses: ./.github/workflows/mac.yml
2929
windows:
3030
needs:
31-
- cpp-lint
31+
- pre-commit
3232
uses: ./.github/workflows/windows.yml
3333
perf:
3434
needs:

.github/workflows/pre-commit.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
name: Pre-commit checks
22

33
on:
4+
push:
45
pull_request:
5-
paths-ignore:
6-
- 'docs/**'
7-
- '*.md'
8-
- '*.rst'
9-
- '*.txt'
10-
- 'LICENSE'
6+
workflow_call:
117

128
jobs:
139
pre-commit:
@@ -28,5 +24,6 @@ jobs:
2824
python3 -m pip install -r requirements.txt
2925
- name: Run pre-commit checks
3026
run: |
31-
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
32-
pre-commit run --from-ref ${{ github.base_ref }} --to-ref HEAD
27+
FROM_REF="${{ github.base_ref || 'HEAD~1' }}"
28+
git fetch origin $FROM_REF:$FROM_REF || true
29+
pre-commit run --from-ref $FROM_REF --to-ref HEAD

0 commit comments

Comments
 (0)