Skip to content

feat(run-pre-commit): Support pinning the rustup version #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions run-pre-commit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- `pre-commit-version` (defaults to `4.2.0`)
- `rust` (eg: `1.80.1`. Disabled if not specified)
- `rust-components` (defaults to `rustfmt,clippy`)
- `rustup-version` (defaults to `1.28.1`)
- `hadolint` (eg: `v2.12.0`. Disabled if not specified)
- `nix` (eg: `2.25.2`. Disabled if not specified)
- `nix-github-token` (eg: `secrets.GITHUB_TOKEN`. Required when `nix` is set)
Expand Down
6 changes: 5 additions & 1 deletion run-pre-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
Override which Rust components are installed. Only takes effect when Rust
is installed.
default: rustfmt,clippy
rustup-version:
description: Rustup version used when setting up the Rust toolchain(s)
default: 1.28.1
hadolint:
description: Whether to install hadolint (and which version to use)
nix:
Expand Down Expand Up @@ -74,14 +77,15 @@ runs:
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.rustup/toolchains
key: rust-toolchains-${{ inputs.rust }}-components-${{ env.RUST_COMPONENTS }}
key: rust-toolchains-${{ inputs.rust }}-components-${{ env.RUST_COMPONENTS }}-rustup-${{ inputs.rustup-version }}

- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0
if: ${{ inputs.rust && steps.rust-toolchain-cache.outputs.cache-hit != 'true' }}
with:
toolchain: ${{ inputs.rust }}
components: ${{ inputs.rust-components }}
rustup-version: ${{ inputs.rustup-version }}

- name: Install Hadolint
if: ${{ inputs.hadolint }}
Expand Down