Permit game versions with .'s

This commit is contained in:
Luke Street
2025-04-15 16:19:56 -06:00
parent b435313c66
commit 488d507194
2 changed files with 27 additions and 15 deletions
+7 -6
View File
@@ -107,11 +107,12 @@ pub async fn run(
.send()
.await
.context("Failed to fetch workflows")?;
let Some(workflow) = workflows
.items
.iter()
.find(|w| w.path.ends_with("build.yml") || w.path.ends_with("progress.yml"))
else {
let Some(workflow) = workflows.items.iter().find(|w| {
w.path.ends_with("build.yml")
|| w.path.ends_with("build.yaml")
|| w.path.ends_with("progress.yml")
|| w.path.ends_with("progress.yaml")
}) else {
log::warn!("No known workflow found for {}/{}", owner_name, repo_name);
return Ok(());
};
@@ -268,7 +269,7 @@ async fn process_workflow_run(
}
static REGEX: OnceLock<Regex> = OnceLock::new();
let regex = REGEX
.get_or_init(|| Regex::new(r"^(?P<version>[A-z0-9_\-]+)[_-]report(?:[_-].*)?$").unwrap());
.get_or_init(|| Regex::new(r"^(?P<version>[A-z0-9_.\-]+)[_-]report(?:[_-].*)?$").unwrap());
let sem = Arc::new(Semaphore::new(3));
let mut set = JoinSet::new();
struct TaskResult {
+11
View File
@@ -168,24 +168,35 @@ impl From<&Measures> for TemplateMeasures {
}
}
fn is_valid_extension(ext: &str) -> bool {
// FIXME: hack for versions that have .nn where nn is a number
ext.chars().any(|c| c.is_ascii_alphabetic())
}
fn extract_extension(params: ReportParams) -> (ReportParams, Option<String>) {
if let Some(commit) = params.commit.as_deref() {
if let Some((commit, ext)) = commit.rsplit_once('.') {
if is_valid_extension(ext) {
return (
ReportParams { commit: Some(commit.to_string()), ..params },
Some(ext.to_string()),
);
}
}
} else if let Some(version) = params.version.as_deref() {
if let Some((version, ext)) = version.rsplit_once('.') {
if is_valid_extension(ext) {
return (
ReportParams { version: Some(version.to_string()), ..params },
Some(ext.to_string()),
);
}
}
} else if let Some((repo, ext)) = params.repo.rsplit_once('.') {
if is_valid_extension(ext) {
return (ReportParams { repo: repo.to_string(), ..params }, Some(ext.to_string()));
}
}
(params, None)
}