Skip to content

Commit ff4f29f

Browse files
drsoochpepeiborra
andauthored
Only run the pre-commit hook on changed files (#3145)
* Only run the pre-commit hook on changed files * Let's change a haskell file * Didn't use the PATTERN field correctly * Move pre-commit block before building stylish-haskell * Try to evaluate GIT_DIFF value to pass to pre-commit * Try to evaluate GIT_DIFF value to pass to pre-commit * Move pre-commit action back to original spot * Introduce bad formatting in a file * Conditionally run the pre-commit job only when there are haskell source changes * Restore haskell files we used for testing * workflow fixes * Try changing haskell source files with new workflow structure * Revert all changes to files during testing Co-authored-by: Pepe Iborra <[email protected]>
1 parent 362ca34 commit ff4f29f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ on:
66
branches: [master]
77

88
jobs:
9+
file-diff:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
git-diff: ${{ steps.git-diff.outputs.diff }}
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
- name: Find changed files
17+
uses: technote-space/[email protected]
18+
id: git-diff
19+
with:
20+
PATTERNS: |
21+
+(src|exe|test|ghcide|plugins|hls-plugin-api|hie-compat|hls-graph|hls-test-utils)/**/*.hs
922
pre-commit:
1023
runs-on: ubuntu-latest
24+
needs: file-diff
1125
steps:
1226
- uses: actions/checkout@v3
13-
1427
- uses: ./.github/actions/setup-build
1528
with:
1629
os: ${{ runner.os }}
@@ -40,3 +53,5 @@ jobs:
4053
4154
- uses: actions/setup-python@v4
4255
- uses: pre-commit/[email protected]
56+
with:
57+
extra_args: --files ${{ needs.file-diff.outputs.git-diff }}

0 commit comments

Comments
 (0)