mirror of
https://github.com/encounter/decomp.dev.git
synced 2026-07-10 03:18:48 -07:00
Permit game versions with .'s
This commit is contained in:
+7
-6
@@ -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 {
|
||||
|
||||
+20
-9
@@ -168,23 +168,34 @@ 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('.') {
|
||||
return (
|
||||
ReportParams { commit: Some(commit.to_string()), ..params },
|
||||
Some(ext.to_string()),
|
||||
);
|
||||
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('.') {
|
||||
return (
|
||||
ReportParams { version: Some(version.to_string()), ..params },
|
||||
Some(ext.to_string()),
|
||||
);
|
||||
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('.') {
|
||||
return (ReportParams { repo: repo.to_string(), ..params }, Some(ext.to_string()));
|
||||
if is_valid_extension(ext) {
|
||||
return (ReportParams { repo: repo.to_string(), ..params }, Some(ext.to_string()));
|
||||
}
|
||||
}
|
||||
(params, None)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user