-
-
Notifications
You must be signed in to change notification settings - Fork 368
59 lines (53 loc) · 1.83 KB
/
pre-commit.yml
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
49
50
51
52
53
54
55
56
57
58
59
name: pre-commit
on:
pull_request:
push:
branches: [master]
jobs:
file-diff:
runs-on: ubuntu-latest
outputs:
git-diff: ${{ steps.git-diff.outputs.diff }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Find changed files
uses: technote-space/get-diff-action@v6.1.2
id: git-diff
with:
PATTERNS: |
+(src|exe|test|ghcide|plugins|hls-plugin-api|hie-compat|hls-graph|hls-test-utils)/**/*.hs
pre-commit:
runs-on: ubuntu-latest
needs: file-diff
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-build
with:
# select a stable GHC version
ghc: 9.2
os: ${{ runner.os }}
shorten-hls: false
- name: "Install stylish-haskell"
run: |
cabal install stylish-haskell
echo "${HOME}/.cabal/bin" >> $GITHUB_PATH
- name: "Check stylish-haskell is available"
run: |
echo $(which stylish-haskell)
- name: Compiled deps cache
id: stylish-haskell-compiled-cache
uses: actions/cache@v3
env:
cache-name: stylish-haskell-compiled-cache
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.0
with:
extra_args: --files ${{ needs.file-diff.outputs.git-diff }}