manager: Render graphviz tree and push it to git
This commit is contained in:
parent
3bd79f176e
commit
8b66d2551a
3 changed files with 81 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ use forgejo_api::Forgejo;
|
|||
mod collect;
|
||||
mod event_meta;
|
||||
mod issue;
|
||||
mod render;
|
||||
mod tree;
|
||||
mod wiki;
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ async fn run() -> anyhow::Result<()> {
|
|||
meta.issue.number
|
||||
);
|
||||
|
||||
let timestamp = chrono::Local::now().format("%Y-%m-%d %H:%M:%S");
|
||||
let timestamp = chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string();
|
||||
log::info!("Timestamp of this run is {timestamp}");
|
||||
|
||||
let token =
|
||||
|
|
@ -33,6 +34,10 @@ async fn run() -> anyhow::Result<()> {
|
|||
)
|
||||
.context("Failed parsing GITHUB_SERVER_URL as a url")?;
|
||||
|
||||
let mut repo_auth_url = server_url.join(&format!("{}/{}", meta.issue.repository.owner, meta.issue.repository.name)).unwrap();
|
||||
repo_auth_url.set_username("forgejo-actions").unwrap();
|
||||
repo_auth_url.set_password(Some(&token)).unwrap();
|
||||
|
||||
let forgejo = Forgejo::new(auth, server_url).context("Could not create API access object")?;
|
||||
|
||||
let new_comment_id = if meta.action == event_meta::IssueAction::Opened {
|
||||
|
|
@ -56,6 +61,11 @@ async fn run() -> anyhow::Result<()> {
|
|||
.await
|
||||
.context("Failed to collect the techtree from issue metadata")?;
|
||||
|
||||
log::info!("Rendering and publishing techtree to git repository...");
|
||||
render::render_and_publish(&tree, ×tamp, &repo_auth_url)
|
||||
.await
|
||||
.context("Failed to render and publish the techtree to git")?;
|
||||
|
||||
let mermaid = tree.to_mermaid();
|
||||
let wiki_text = format!(
|
||||
r##"This page is automatically updated to show the latest and greatest FAFO techtree:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue