Skip to content

Commit

Permalink
fix: allow a 3rd option for workflow link (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: Wolftousen <[email protected]>
  • Loading branch information
Wolftousen and Wolftousen authored Aug 16, 2024
1 parent ac9c87d commit 17d50b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/helpers/loki.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub struct WorkflowRun {
pub head_sha: String,
pub workflow_id: Option<u32>,
pub url: Option<String>,
pub html_url: Option<String>,
}

#[derive(Deserialize, Debug)]
Expand Down Expand Up @@ -260,7 +261,9 @@ async fn sort_deploy_data(data: QueryResponse) -> HashMap<String, Vec<DeployEntr

match b.json_data.body.workflow_run {
Some(wf) => {
if wf.workflow_id.is_some() {
if wf.html_url.is_some() {
wf_url = wf.html_url.unwrap()
} else if wf.workflow_id.is_some() {
wf_url = d.url.replace("api.", "").replace("repos/", "").replace("deployments/", "actions/runs/").replace(d.id.to_string().as_str(), wf.workflow_id.unwrap().to_string().as_str());
} else if wf.url.is_some() {
wf_url = wf.url.unwrap().replace("api.", "").replace("repos/", "");
Expand Down

0 comments on commit 17d50b6

Please sign in to comment.