-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull-request-precommit-checks.yml
More file actions
78 lines (67 loc) · 2.59 KB
/
Copy pathpull-request-precommit-checks.yml
File metadata and controls
78 lines (67 loc) · 2.59 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Pre-Commit Checks
on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ main ]
jobs:
pre-commit:
name: Pre-Commit Checks
permissions:
pull-requests: read
contents: read
statuses: write
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v6
- id: setup-python
name: Set up Python 3.14
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
with:
python-version: 3.14
- id: install-tools
name: Install Tools with uv
run: |
uv tool install pre-commit --with pre-commit-uv
# If we've cached the pre-commit environment, restore it based on the hash of the pre-commit config.
- id: cache
name: Restore cached pre-commit environment
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- id: setup-asdf
name: Setup ASDF
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
- id: restore-asdf-tools
name: Restore ASDF tools from cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
path: |
~/.asdf/plugins
~/.asdf/installs
- id: install-asdf
name: Install ASDF tools on cache-miss
if: ${{ steps.restore-asdf-tools.outputs.cache-hit != 'true' }}
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
- id: asdf-reshim
name: Reshim installed ASDF tools
run: asdf reshim
- id: pre-commit
name: Run pre-commit checks
run: uv run pre-commit run --all-files --show-diff-on-failure
- id: set-status-check
name: Set Status Check
if: always()
uses: launchbynttdata/launch-workflows/.github/actions/update-status-check@edddecdce4590f94f30d0fdfdf991d8a692fe8dd
with:
check_name: "Pre-Commit Checks"
status: ${{ steps.pre-commit.outcome == 'success' && 'success' ||
steps.pre-commit.outcome == 'failure' && 'failure' || 'error' }}
description: "Pre-Commit Checks ${{steps.pre-commit.outcome }}"
target_url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{
github.run_id }}"