File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 88 python-version :
99 description : Python version to install
1010 default : " 3.12"
11+ pre-commit-version :
12+ description : Pre-commit version to install
13+ default : 4.2.0
1114 rust :
1215 description : Whether to install the Rust toolchain (and which version to use)
1316 rust-components :
3336 cache-dependency-path : .pre-commit-config.yaml
3437 cache : ' pip'
3538
39+ - name : Install pre-commit (${{ env.PRE_COMMIT_VERSION }})
40+ shell : bash
41+ env :
42+ PRE_COMMIT_VERSION : ${{ inputs.pre-commit-version }}
43+ run : |
44+ python -m pip install "pre-commit==$PRE_COMMIT_VERSION"
45+
46+ # This caches downloaded pre-commit hook artifacts and results in faster
47+ # workflow runs after an initial hydration run with the exact same hooks
48+ - name : Setup pre-commit Cache
49+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
50+ with :
51+ path : ~/.cache/pre-commit
52+ key : pre-commit-${{ inputs.pre-commit-version }}-python${{ inputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
53+
3654 - name : Setup Rust Toolchain
3755 uses : dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c
3856 if : ${{ inputs.rust }}
7290 github_access_token : ${{ inputs.nix-github-token }}
7391 install_url : https://releases.nixos.org/nix/nix-${{ inputs.nix }}/install
7492
75- - uses : pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
76- with :
77- extra_args : " --from-ref '${{ github.event.pull_request.base.sha }}' --to-ref '${{ github.event.pull_request.head.sha }}'"
93+ - name : Run pre-commit
94+ shell : bash
95+ env :
96+ BASE_SHA : ${{ github.event.pull_request.base.sha }}
97+ HEAD_SHA : ${{ github.event.pull_request.head.sha }}
98+ run : |
99+ pre-commit run --show-diff-on-failure --color always --from-ref "$BASE_SHA" --to-ref "$HEAD_SHA"
You can’t perform that action at this time.
0 commit comments