From 6968062c334e95c5dfe32226f3ea0801520e1af3 Mon Sep 17 00:00:00 2001 From: zjp Date: Sun, 6 Apr 2025 22:59:41 +0800 Subject: [PATCH 1/3] fix(workflows): dedup scheduling workflows to get latest success and completed states close https://github.com/os-checker/os-checker.github.io/issues/158 --- src/workflows/summary.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/workflows/summary.rs b/src/workflows/summary.rs index a9a42c9..b67df4b 100644 --- a/src/workflows/summary.rs +++ b/src/workflows/summary.rs @@ -71,13 +71,21 @@ impl Summary { let created_at = run.created_at; let updated_at = run.updated_at; + // only keep the first run name because repeated run names exist for the + // same sha due to scheduling + let unique_name = { + let mut v = wf.to_vec(); + v.sort_by_key(|w| w.run.name.as_str()); + v.dedup_by_key(|w| w.run.name.as_str()); + v + }; summary.last = Some(LastWorkflow { created_at, updated_at, duration_sec: duration_sec(created_at, updated_at), // must check all latset data - completed: wf.iter().all(|w| w.run.status == "completed"), - success: wf + completed: unique_name.iter().all(|w| w.run.status == "completed"), + success: unique_name .iter() .all(|w| w.run.conclusion.as_deref() == Some("success")), head_branch: run.head_branch.clone(), From 6f9a5f5249d8abaefe2ea64a5b08213956e035c7 Mon Sep 17 00:00:00 2001 From: zjp Date: Sun, 6 Apr 2025 23:01:52 +0800 Subject: [PATCH 2/3] gitignore /github-api --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 787aa48..6a66384 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /tmp +/github-api From 395e9f2e4c789dd006b65ceed942ad5c530a5c6c Mon Sep 17 00:00:00 2001 From: zjp Date: Sun, 6 Apr 2025 23:02:29 +0800 Subject: [PATCH 3/3] ci: trigger on pushing to all branches --- .github/workflows/run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 0fe6792..378cac8 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -4,7 +4,7 @@ on: schedule: - cron: '0 0/3 * * *' push: - branches: [ main, feat/* ] + branches: env: CARGO_TERM_COLOR: always