Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/pr_pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: pre-commit
on:
pull_request:

permissions: {}

jobs:
pre-commit:
Expand All @@ -15,3 +16,5 @@ jobs:
submodules: recursive
fetch-depth: 0
- uses: ./run-pre-commit
with:
rust-tools: [email protected]
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ repos:
rev: 5db9d9cde2f3deb5035dea3e45f0a9fff2f29448 # 1.7.4
hooks:
- id: actionlint

- repo: local
hooks:
- id: zizmor
name: zizmor
language: system
files: ^\.github/workflows/
entry: zizmor
stages: [pre-commit]
pass_filenames: true
17 changes: 17 additions & 0 deletions run-pre-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ inputs:
Override which Rust components are installed. Only takes effect when Rust
is installed.
default: rustfmt,clippy
rust-tools:
description: |
Install Rust-based tools using `cargo install --locked`. Tools can be
specified using the following format: `CRATE[@<VER>]`. Individual tools
are separated by space
hadolint:
description: Whether to install hadolint (and which version to use)
nix:
Expand All @@ -38,6 +43,18 @@ runs:
toolchain: ${{ inputs.rust }}
components: ${{ inputs.rust-components }}

- name: Install Rust Tools
if: ${{ inputs.rust-tools }}
env:
RUST_TOOLS: ${{ inputs.rust-tools }}
shell: bash
run: |
set -euo pipefail

# Make a list out of the space separated list off tools/crates
RUST_TOOLS=($RUST_TOOLS)
cargo install --locked "${RUST_TOOLS[@]}"

- name: Setup Hadolint
if: ${{ inputs.hadolint }}
shell: bash
Expand Down