enhance(actions): show the steps the runner reports (#39720)

Gitea derives the steps of a job from the workflow file, so the `pre`
and `post` steps of actions only show up inside "Set up job" and
"Complete job".
Fixes https://github.com/go-gitea/gitea/issues/24604.

A runner can now report the steps it actually runs, and Gitea shows
those instead. Runners that don't report them keep the current view, and
older Gitea versions ignore them.

Related:
- Proto: https://gitea.com/gitea/actions-proto-def/pulls/19
- Runner: https://gitea.com/gitea/runner/pulls/1293
This commit is contained in:
bircni authored and GitHub committed 2026-10-12 22:36:25 +02:00
1 parent c501255d47
commit 4b5f1f46de
11 files changed
+337 -29

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ func FullSteps(task *actions_model.ActionTask) []*actions_model.ActionTaskStep {
if len(task.Steps) == 0 {
return fullStepsOfEmptySteps(task)
}
if task.Steps[0].IsReported() {
return task.Steps // the runner reports its own setup and cleanup steps
}
// firstStep is the first step that has run or running, not include preStep.
// For example,
+16
View File
@@ -6,6 +6,7 @@ package actions
import (
"testing"
runnerv1 "gitea.dev/actionslib/runner/v1"
actions_model "gitea.dev/models/actions"
"github.com/stretchr/testify/assert"
@@ -55,6 +56,21 @@ func TestFullSteps(t *testing.T) {
{Name: postStepName, Status: actions_model.StatusFailure, LogIndex: 90, LogLength: 10, Started: 10090, Stopped: 10100},
},
},
{
name: "reported by the runner",
task: &actions_model.ActionTask{
Steps: []*actions_model.ActionTaskStep{
{Name: "Set up job", Stage: int64(runnerv1.StepStage_STEP_STAGE_SETUP), Status: actions_model.StatusSuccess, LogLength: 10},
{Name: "Run echo", Stage: int64(runnerv1.StepStage_STEP_STAGE_MAIN), Status: actions_model.StatusRunning, LogIndex: 10, LogLength: 5},
},
Status: actions_model.StatusRunning,
LogLength: 15,
},
want: []*actions_model.ActionTaskStep{
{Name: "Set up job", Stage: int64(runnerv1.StepStage_STEP_STAGE_SETUP), Status: actions_model.StatusSuccess, LogLength: 10},
{Name: "Run echo", Stage: int64(runnerv1.StepStage_STEP_STAGE_MAIN), Status: actions_model.StatusRunning, LogIndex: 10, LogLength: 5},
},
},
{
name: "first step is running",
task: &actions_model.ActionTask{