Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
datasourceTemplate: "github-release-attachments",
packageNameTemplate: "jdx/mise",
depNameTemplate: "mise",
matchStrings: ["jdx/mise-action.*\\n\\s*with:\\s*\\n\\s*version: [\"']?(?<currentValue>v[.\\d]+)[\"']?\\s*\\n\\s*sha256: [\"']?(?<currentDigest>\\w+)[\"']?"],
matchStrings: ["jdx/mise-action.*\\n\\s*with:\\s*\\n\\s*version: [\"']?(?<currentValue>v[.\\d]+)[\"']?\\s*\\n\\s*sha256:\\s*(?:(?:[>|][-+]?)\\s*\\n\\s*)?[\"']?(?<currentDigest>[a-f0-9]{64})[\"']?"],
},
{
customType: "regex",
Expand All @@ -90,7 +90,7 @@
datasourceTemplate: "github-release-attachments",
packageNameTemplate: "jdx/mise",
depNameTemplate: "mise",
matchStrings: ["jdx/mise-action.*\\n\\s*with:\\s*\\n\\s*version: [\"']?(?<currentValue>v[.\\d]+)[\"']?\\s*\\n\\s*sha256: [\"']?(?<currentDigest>\\w+)[\"']?"],
matchStrings: ["jdx/mise-action.*\\n\\s*with:\\s*\\n\\s*version: [\"']?(?<currentValue>v[.\\d]+)[\"']?\\s*\\n\\s*sha256:\\s*(?:(?:[>|][-+]?)\\s*\\n\\s*)?[\"']?(?<currentDigest>[a-f0-9]{64})[\"']?"],
},
],
packageRules: [
Expand Down
2 changes: 1 addition & 1 deletion default.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"packageNameTemplate": "jdx/mise",
"depNameTemplate": "mise",
"matchStrings": [
"jdx/mise-action.*\\n\\s*with:\\s*\\n\\s*version: [\"']?(?<currentValue>v[.\\d]+)[\"']?\\s*\\n\\s*sha256: [\"']?(?<currentDigest>\\w+)[\"']?"
"jdx/mise-action.*\\n\\s*with:\\s*\\n\\s*version: [\"']?(?<currentValue>v[.\\d]+)[\"']?\\s*\\n\\s*sha256:\\s*(?:(?:[>|][-+]?)\\s*\\n\\s*)?[\"']?(?<currentDigest>[a-f0-9]{64})[\"']?"
]
}
],
Expand Down
64 changes: 64 additions & 0 deletions src/registry/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::collections::{BTreeSet, HashMap};
use std::path::Path;

use regex::Regex;

use super::*;

#[path = "../readme_snippets.rs"]
Expand Down Expand Up @@ -509,6 +511,68 @@ fn repo_renovate_config_stays_aligned_with_shared_preset_contract() {
}
}

#[test]
fn mise_action_custom_manager_matches_plain_and_block_scalar_sha256() {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let default_json_path = manifest_dir.join("default.json");
let default_json =
std::fs::read_to_string(&default_json_path).expect("default.json must be readable");
let parsed: serde_json::Value =
serde_json::from_str(&default_json).expect("default.json must be valid JSON");

let description = "Update mise version in GitHub Actions workflows";
let manager = custom_manager_by_description(&parsed, description)
.unwrap_or_else(|| panic!("default.json missing custom manager {description:?}"));
let pattern = manager["matchStrings"][0]
.as_str()
.expect("custom manager match string must be a string");
let regex = Regex::new(pattern).expect("custom manager regex must compile");

for (name, sample) in [
(
"plain scalar",
r#"
- name: Setup mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
version: v2026.4.28
sha256: 9655492db554e8f70a69830f54307ac0f4681d6c42f9844e862528b7853d09d1
"#,
),
(
"block scalar",
r#"
- name: Setup mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
version: v2026.4.28
sha256: >-
c55befc52e5694f388b927ef304362ca7b9e919d97d43c342fca57f2eccea255
"#,
),
] {
let captures = regex
.captures(sample)
.unwrap_or_else(|| panic!("regex must match {name} mise-action YAML"));
assert_eq!(
captures.name("currentValue").map(|value| value.as_str()),
Some("v2026.4.28"),
"regex must capture the mise version for {name}"
);
assert_eq!(
captures.name("currentDigest").map(|value| value.as_str()),
Some(match name {
"plain scalar" =>
"9655492db554e8f70a69830f54307ac0f4681d6c42f9844e862528b7853d09d1",
"block scalar" =>
"c55befc52e5694f388b927ef304362ca7b9e919d97d43c342fca57f2eccea255",
_ => unreachable!("unexpected sample"),
}),
"regex must capture the mise sha256 digest for {name}"
);
}
}

#[test]
fn linter_keys_include_mise_and_bare_tool_names() {
let keys = linter_keys();
Expand Down
Loading