fix: display error details for failed workflow executions

This commit is contained in:
bahdotsh
2025-04-21 17:22:38 +05:30
parent 622a9081ea
commit cd89b64015
4 changed files with 17 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ name: Test
on:
workflow_dispatch:
jobs:
jo:
test:
runs-on: 'ubuntu-latest'
steps:

2
Cargo.lock generated
View File

@@ -2324,7 +2324,7 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "wrkflw"
version = "0.2.1"
version = "0.3.0"
dependencies = [
"async-trait",
"bollard",

View File

@@ -1,6 +1,6 @@
[package]
name = "wrkflw"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
description = "A GitHub Actions workflow validator and executor"
documentation = "https://github.com/bahdotsh/wrkflw"

View File

@@ -540,10 +540,10 @@ impl App {
},
output: step_result.output.clone(),
})
.collect(),
.collect::<Vec<StepExecution>>(),
logs: vec![job_result.logs.clone()],
})
.collect();
.collect::<Vec<JobExecution>>();
}
Err(e) => {
let timestamp = Local::now().format("%H:%M:%S").to_string();
@@ -551,6 +551,18 @@ impl App {
.logs
.push(format!("[{}] Error: {}", timestamp, e));
execution_details.progress = 1.0;
// Create a dummy job with the error information so users can see details
execution_details.jobs = vec![JobExecution {
name: "Workflow Execution".to_string(),
status: JobStatus::Failure,
steps: vec![StepExecution {
name: "Execution Error".to_string(),
status: StepStatus::Failure,
output: format!("Error: {}\n\nThis error prevented the workflow from executing properly.", e),
}],
logs: vec![format!("Workflow execution error: {}", e)],
}];
}
}
}