File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
> Manifest: [ run-pre-commit/action.yml] [ run-pre-commit ]
4
4
5
- This action runs pre-commit by setting up Python and optionally the Rust toolchain and Hadolint in
6
- the requested version. It requires a checkout with depth 0. It does the following work:
5
+ This action runs pre-commit by setting up Python and optionally installing the Rust toolchain,
6
+ Hadolint, and Nix in the requested version. It requires a checkout with depth 0. It does the
7
+ following work:
7
8
8
9
1 . Installs Python. The version can be configured via the ` python-version ` input.
9
- 2 . Optionally sets up the Rust toolchain and Hadolint .
10
+ 2 . Optionally sets up the Rust toolchain, Hadolint, and Nix .
10
11
3 . Runs pre-commit on changed files.
11
12
12
13
Example usage (workflow):
40
41
- `rust` (eg : ` 1.80.1` . Disabled if not specified)
41
42
- ` rust-components` (defaults to `rustfmt,clippy`)
42
43
- `hadolint` (eg : ` v2.12.0` . Disabled if not specified)
44
+ - `nix` (eg : ` 2.25.2` . Disabled if not specified)
45
+ - `nix-github-token` (eg : ` secrets.GITHUB_TOKEN` . Required when `nix` is set)
43
46
44
47
# ## Outputs
45
48
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ inputs:
17
17
default : rustfmt,clippy
18
18
hadolint :
19
19
description : Whether to install hadolint (and which version to use)
20
+ nix :
21
+ description : Whether to install nix (and which version to use)
22
+ nix-github-token :
23
+ description : |
24
+ The GitHub token is used by Nix to pull from GitHub with higher rate-limits. Required when
25
+ the 'nix' input is used.
20
26
runs :
21
27
using : composite
22
28
steps :
50
56
51
57
echo "$LOCATION_DIR" | tee -a "$GITHUB_PATH"
52
58
59
+ - name : Abort if nix-github-token input is not set
60
+ if : inputs.nix && !inputs.nix-github-token
61
+ shell : bash
62
+ run : |
63
+ echo "nix-github-token input must be set when nix input is set"
64
+ exit 1
65
+
66
+ - name : Setup nix
67
+ if : inputs.nix
68
+ uses : cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
69
+ with :
70
+ github_access_token : ${{ inputs.nix-github-token }}
71
+ install_url : https://releases.nixos.org/nix/nix-${{ inputs.nix }}/install
72
+
53
73
- uses : pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
54
74
with :
55
75
extra_args : " --from-ref '${{ github.event.pull_request.base.sha }}' --to-ref '${{ github.event.pull_request.head.sha }}'"
You can’t perform that action at this time.
0 commit comments