|
8 | 8 | jobs:
|
9 | 9 | pre-commit:
|
10 | 10 | runs-on: ubuntu-latest
|
| 11 | + |
11 | 12 | steps:
|
12 | 13 | - uses: actions/checkout@v3
|
13 | 14 | with:
|
14 | 15 | # Need to grab the history of the PR
|
15 | 16 | fetch-depth: 0
|
16 |
| - - uses: actions/setup-node@v4 |
17 |
| - with: |
18 |
| - node-version-file: "package.json" |
19 |
| - registry-url: "https://registry.npmjs.org" |
20 |
| - - uses: ./.github/actions/python-poetry |
21 |
| - - uses: actions-rs/toolchain@v1 |
22 |
| - with: |
23 |
| - profile: minimal |
24 |
| - toolchain: 1.85.1 |
25 |
| - components: clippy |
26 |
| - - uses: actions-rs/toolchain@v1 |
27 |
| - with: |
28 |
| - profile: minimal |
29 |
| - toolchain: nightly-2024-12-03 |
30 |
| - components: rustfmt |
31 |
| - - name: Install Protoc |
32 |
| - uses: arduino/setup-protoc@v3 |
33 |
| - with: |
34 |
| - version: "28.x" |
35 |
| - - uses: pnpm/action-setup@v4 |
36 |
| - name: Install pnpm |
| 17 | + |
| 18 | + - name: Set up Python (for pre-commit) |
| 19 | + uses: actions/setup-python@v5 |
37 | 20 | with:
|
38 |
| - run_install: true |
39 |
| - - name: Install Anchor CLI |
40 |
| - run: | |
41 |
| - cargo install --git https://github.com/coral-xyz/anchor avm |
42 |
| - avm install 0.31.0 |
43 |
| - avm use 0.31.0 |
44 |
| - - uses: pre-commit/[email protected] |
| 21 | + python-version: '3.x' |
| 22 | + |
| 23 | + - name: Install pre-commit |
| 24 | + run: pip install pre-commit |
| 25 | + |
| 26 | + - name: Run pre-commit on PR diff |
45 | 27 | if: ${{ github.event_name == 'pull_request' }}
|
46 |
| - with: |
47 |
| - # Run only on files changed in the PR |
48 |
| - extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} |
49 |
| - - uses: pre-commit/[email protected] |
| 28 | + run: | |
| 29 | + pre-commit run --from-ref "${{ github.event.pull_request.base.sha }}" \ |
| 30 | + --to-ref "${{ github.event.pull_request.head.sha }}" |
| 31 | +
|
| 32 | + - name: Run pre-commit on all files (non-PR pushes) |
50 | 33 | if: ${{ github.event_name != 'pull_request' }}
|
| 34 | + run: pre-commit run --all-files |
0 commit comments