From d6c7bd54efc0516fc561926279b36408b77fba33 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 1 Jul 2023 14:32:38 -0700 Subject: add og tags to commit summaries? --- src/main.rs | 53 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/main.rs b/src/main.rs index f008a56..3e9f034 100644 --- a/src/main.rs +++ b/src/main.rs @@ -505,40 +505,57 @@ async fn handle_commit_status(Path(path): Path<(String, String, String)>, State( let complete_time = run.complete_time.unwrap_or_else(crate::io::now_ms); - let debug_info = run.state == RunState::Finished && run.build_result == Some(1) || run.state == RunState::Error; - - let repo_name: String = ctx.dbctx.conn.lock().unwrap() - .query_row("select repo_name from repos where id=?1;", [repo_id], |row| row.get(0)) - .expect("can query"); - - let deployed = false; - - let head = format!("ci.butactuallyin.space - {}", repo_name); - let repo_html = format!("{}", &repo_name, &repo_name); - let remote_commit_elem = format!("{}", &remote_path, &sha, &sha); - let status_elem = match run.state { + let (status_elem, status_desc) = match run.state { RunState::Pending | RunState::Started => { - "pending" + ("pending", "βŒ›in progress") }, RunState::Finished => { if let Some(build_result) = run.build_result { if build_result == 0 { - "pass" + ("pass", "βœ… passed") } else { - "failed" + ("failed", "❌ failed") } } else { eprintln!("run {} for commit {} is missing a build result but is reportedly finished (old data)?", run.id, commit_id); - "unreported" + ("unreported", "❔ missing status") } }, RunState::Error => { - "error" + ("error", "🧯 error, uncompleted") } RunState::Invalid => { - "(server error)" + ("(server error)", "dude even i don't know") } }; + let debug_info = run.state == RunState::Finished && run.build_result == Some(1) || run.state == RunState::Error; + + let repo_name: String = ctx.dbctx.conn.lock().unwrap() + .query_row("select repo_name from repos where id=?1;", [repo_id], |row| row.get(0)) + .expect("can query"); + + let deployed = false; + + let mut head = String::new(); + head.push_str(""); + head.push_str(&format!("ci.butactuallyin.space - {}", repo_name)); + let include_og_tags = true; + if include_og_tags { + head.push_str("\n"); + head.push_str(&format!("\n")); + head.push_str(&format!("\n")); + head.push_str(&format!("", build_og_description)); + } + head.push_str("\n"); + let repo_html = format!("{}", &repo_name, &repo_name); + let remote_commit_elem = format!("{}", &remote_path, &sha, &sha); let mut artifacts_fragment = String::new(); let mut artifacts: Vec = ctx.dbctx.artifacts_for_run(run.id, None).unwrap() -- cgit v1.1