Skip to content

Commit a86812a

Browse files
committed
feat: use mise exec to run most steps
...to remove the need to add the tools to the mise config and to be able to specify tool versions in the shared hk configuration.
1 parent a09dc22 commit a86812a

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

Shared.pkl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,34 @@ actionlint = (Builtins.actionlint) {
55
// extend to include actiion.yml/yaml files XXX turned out this is not supported by actionlint at the moment
66
// glob = List(".github/workflows/*.yml", ".github/workflows/*.yaml", "action.yml", "action.yaml")
77

8+
prefix = "mise x actionlint --"
9+
810
// exclude managed tf- files which are generated
911
exclude = List(".github/workflows/tf-*")
1012
}
1113

1214
prettier = (Builtins.prettier) {
15+
prefix = "mise x prettier --"
16+
1317
// exclude files which are generated/managed
1418
exclude = List(".github/workflows/tf-*", "CHANGELOG.md")
1519
}
1620

17-
pkl = Builtins.pkl
21+
local pkl_version = "0.30.0"
22+
local pkl_prefix = "mise x pkl@\(pkl_version) --"
23+
24+
pkl = (Builtins.pkl) {
25+
prefix = pkl_prefix
26+
}
1827

1928
// Note: supported since pkl 0.30 - https://pkl-lang.org/main/current/release-notes/0.30.html
2029
// TODO use Builtins.pkl_format as soon as hk is released (>1.25.0)
2130
pklformat = new Config.Step {
2231
stage = "<JOB_FILES>"
2332
glob = "*.pkl"
33+
prefix = pkl_prefix
2434
check = "pkl format --silent {{files}}"
25-
// exit code of pkl format is 1 if changes were made, so we first attempt to write changes with -w, and if that fails, we run again with --silent to ensure a zero exit code on success
35+
// exit code of pkl format is not zero if changes were made, so we first attempt to write changes with -w, and then run again with --silent to ensure a zero exit code on success
2636
fix = "pkl format -w {{files}} || pkl format --silent {{files}}"
2737
}
2838

@@ -50,32 +60,39 @@ spotlessGradle = new Config.Step {
5060
// Secret detection tools
5161

5262
// https://github.com/Yelp/detect-secrets
53-
// mise: pipx:detect-secrets
5463
detectsecrets = new Config.Step {
5564
// needs a baseline
5665
// create with `detect-secrets scan > .secrets.baseline`
5766
// check will fail if file does not exist
5867
check = "detect-secrets-hook --baseline .secrets.baseline {{files}}"
68+
69+
prefix = "mise x pipx:detect-secrets --"
5970
}
6071

6172
// https://github.com/sirwart/ripsecrets
6273
ripsecrets = new Config.Step {
6374
check = "ripsecrets {{files}}"
75+
prefix = "mise x ripsecrets --"
6476
}
6577

6678
// https://github.com/gitleaks/gitleaks
6779
gitleaks = new Config.Step {
80+
// don't use latest as there may be breaking changes (even for minor version updates)
81+
local gitleaks_version = "8.30.0"
6882
// XXX scans whole folder if there are multiple files (see https://github.com/gitleaks/gitleaks/issues/1727)
6983
check = "gitleaks dir -v {{files}}"
84+
prefix = "mise x gitleaks@\(gitleaks_version) --"
7085
}
7186

7287
// https://github.com/trufflesecurity/trufflehog
7388
trufflehog = new Config.Step {
7489
check = "trufflehog filesystem {{files}} --fail"
90+
prefix = "mise x trufflehog --"
7591
}
7692

7793
// https://trivy.dev/docs/latest/scanner/secret/
7894
trivysecrets = new Config.Step {
7995
// Note: trivy fs can only take one file/path as argument, so we can only scan the current directory and not pass the files
8096
check = "trivy fs --exit-code 1 --scanners secret ."
97+
prefix = "mise x trivy --"
8198
}

mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[tools]
2+
# for git hooks
23
hk = "latest"
34
pkl = "latest"
4-
prettier = "3"

0 commit comments

Comments
 (0)