-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.26 KB
/
pre-commit.yml
File metadata and controls
49 lines (40 loc) · 1.26 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
44
45
46
47
48
49
---
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
# Pin prek cache to a known path for reliable GitHub Actions caching
PREK_HOME: ~/.prek-cache
jobs:
run:
name: Pre-Commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
# Shallow fetch of all branch tips so prek can diff against the base
- name: Fetch branch refs for diff
run: git fetch --no-tags --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- uses: ./.github/actions/pnpm-tasks
- id: prek-cache
uses: actions/cache@v4
with:
key: prek-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
path: ${{ env.PREK_HOME }}
restore-keys: |
prek-${{ runner.os }}-
- name: Run pre-commit hooks
run: |
pnpm exec prek run \
--color=always \
--show-diff-on-failure \
--verbose \
--from-ref=origin/${{ github.base_ref }} \
--to-ref=${{ github.event.pull_request.head.sha }}
- if: steps.prek-cache.outputs.cache-hit != 'true'
name: Prune stale environments
run: pnpm exec prek cache gc
name: Pre-Commit
on:
pull_request:
branches: [main]
workflow_call: {}
permissions:
contents: read