From bc6ebd3919b3e8b850326badd4de3862b5176dbb Mon Sep 17 00:00:00 2001 From: Robbie Blaine Date: Sat, 27 Jun 2026 10:43:43 +0200 Subject: [PATCH] Skip redundant lint steps via hk `ci` profile The lint workflow runs `cargo clippy` and `cargo fmt --check` as dedicated steps and then invokes `hk check --all`. Suppressing the redundant re-runs through three repeated `--skip-step` flags worked but scattered CI-only policy across the workflow, prone to drifting from `hk.pkl`. Define the skips declaratively instead: tag `cargo_clippy`, `cargo_format`, and `no_commit_protected_branch` with `profiles = List("!ci")` so they still run locally but are disabled under the `ci` profile. The workflow now runs `hk check --all --profile ci`, keeping the skip policy in one place and matching the dedicated clippy and fmt steps that precede it. Glory to the Omnissiah --- .github/workflows/lint.yml | 2 +- hk.pkl | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d7aecce..c0dfc0c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -58,6 +58,6 @@ jobs: - run: cargo clippy --all-targets --all-features --workspace - run: cargo fmt --check --all - - run: hk check --all --skip-step no_commit_protected_branch + - run: hk check --all --profile ci env: GITHUB_TOKEN: ${{ github.token }} diff --git a/hk.pkl b/hk.pkl index 132a103..4b60e1c 100644 --- a/hk.pkl +++ b/hk.pkl @@ -9,9 +9,15 @@ local linters = new Mapping { // Lint Github Actions ["action_lint"] = Builtins.actionlint // Cargo clippy - ["cargo_clippy"] = Builtins.cargo_clippy + ["cargo_clippy"] = (Builtins.cargo_clippy) { + // Skipped under the `ci` profile; CI runs clippy as a dedicated step + profiles = List("!ci") + } // Cargo format - ["cargo_format"] = Builtins.cargo_fmt + ["cargo_format"] = (Builtins.cargo_fmt) { + // Skipped under the `ci` profile; CI runs `cargo fmt --check` as a dedicated step + profiles = List("!ci") + } // Detect accidentally committed private keys ["detect_private_key"] = Builtins.detect_private_key // Format TOML files @@ -25,7 +31,10 @@ local linters = new Mapping { // Ensure all files end in a new line ["newlines"] = Builtins.newlines // No commit to protected branches - ["no_commit_protected_branch"] = Builtins.no_commit_to_branch + ["no_commit_protected_branch"] = (Builtins.no_commit_to_branch) { + // Skipped under the `ci` profile; CI legitimately runs on protected branches + profiles = List("!ci") + } // Format Pickle files ["pkl_format"] = Builtins.pkl_format // Lint Pickle files