Fix step mapping: only real YAML steps get StepState entries

Forgejo's "Set up job" and "Complete job" are virtual UI steps that
auto-collect logs outside any real step's range. Only the actual YAML
step (id=0) needs a StepState. Setup logs before its log_index go to
"Set up job" automatically.
This commit is contained in:
Till Wegmueller 2026-04-07 00:36:33 +02:00
parent f61588e68b
commit ea3a249918

View file

@ -215,35 +215,21 @@ async fn report_to_forgejo(
total_lines = setup_lines + work_lines;
// Step 0: "Set up job" — boot, env, tool_check etc.
// Forgejo's "Set up job" and "Complete job" are virtual UI steps —
// they auto-collect logs outside any real step's range. Only actual
// YAML steps need StepState entries with matching IDs.
//
// The YAML trigger has 1 step (id=0). Logs before its log_index
// go to "Set up job", logs in its range go to the step, and
// any logs after go to "Complete job".
step_states.push(StepState {
id: 0,
result: v1::Result::Success as i32,
started_at: Some(now.clone()),
stopped_at: Some(now.clone()),
log_index: 0,
log_length: setup_lines,
});
// Step 1: The Actions YAML step — KDL workflow steps + other output
step_states.push(StepState {
id: 1,
result: result as i32,
started_at: Some(now.clone()),
stopped_at: Some(now.clone()),
log_index: setup_lines,
log_length: work_lines,
});
// Step 2: "Complete job"
step_states.push(StepState {
id: 2,
result: result as i32,
started_at: Some(now.clone()),
stopped_at: Some(now.clone()),
log_index: total_lines,
log_length: 0,
});
}
// Send final "no more logs" marker