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()
|
.send()
|
||||||
.await
|
.await
|
||||||
.context("Failed to fetch workflows")?;
|
.context("Failed to fetch workflows")?;
|
||||||
let Some(workflow) = workflows
|
let Some(workflow) = workflows.items.iter().find(|w| {
|
||||||
.items
|
w.path.ends_with("build.yml")
|
||||||
.iter()
|
|| w.path.ends_with("build.yaml")
|
||||||
.find(|w| w.path.ends_with("build.yml") || w.path.ends_with("progress.yml"))
|
|| w.path.ends_with("progress.yml")
|
||||||
else {
|
|| w.path.ends_with("progress.yaml")
|
||||||
|
}) else {
|
||||||
log::warn!("No known workflow found for {}/{}", owner_name, repo_name);
|
log::warn!("No known workflow found for {}/{}", owner_name, repo_name);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
@@ -268,7 +269,7 @@ async fn process_workflow_run(
|
|||||||
}
|
}
|
||||||
static REGEX: OnceLock<Regex> = OnceLock::new();
|
static REGEX: OnceLock<Regex> = OnceLock::new();
|
||||||
let regex = REGEX
|
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 sem = Arc::new(Semaphore::new(3));
|
||||||
let mut set = JoinSet::new();
|
let mut set = JoinSet::new();
|
||||||
struct TaskResult {
|
struct TaskResult {
|
||||||
|
|||||||
@@ -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>) {
|
fn extract_extension(params: ReportParams) -> (ReportParams, Option<String>) {
|
||||||
if let Some(commit) = params.commit.as_deref() {
|
if let Some(commit) = params.commit.as_deref() {
|
||||||
if let Some((commit, ext)) = commit.rsplit_once('.') {
|
if let Some((commit, ext)) = commit.rsplit_once('.') {
|
||||||
|
if is_valid_extension(ext) {
|
||||||
return (
|
return (
|
||||||
ReportParams { commit: Some(commit.to_string()), ..params },
|
ReportParams { commit: Some(commit.to_string()), ..params },
|
||||||
Some(ext.to_string()),
|
Some(ext.to_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if let Some(version) = params.version.as_deref() {
|
} else if let Some(version) = params.version.as_deref() {
|
||||||
if let Some((version, ext)) = version.rsplit_once('.') {
|
if let Some((version, ext)) = version.rsplit_once('.') {
|
||||||
|
if is_valid_extension(ext) {
|
||||||
return (
|
return (
|
||||||
ReportParams { version: Some(version.to_string()), ..params },
|
ReportParams { version: Some(version.to_string()), ..params },
|
||||||
Some(ext.to_string()),
|
Some(ext.to_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if let Some((repo, ext)) = params.repo.rsplit_once('.') {
|
} 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()));
|
return (ReportParams { repo: repo.to_string(), ..params }, Some(ext.to_string()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
(params, None)
|
(params, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user