Files
Gitea/tests
Nicolas afcd11c77f BUG: Fix workflow run jobs API returning null steps (#36603)
## Problem

`GET /api/v1/repos/{owner}/{repo}/actions/runs/{runId}/jobs` was always
returning `steps: null` for each job.

## Cause

In `convert.ToActionWorkflowJob`, when the job had a `TaskID` we loaded
the task with `db.GetByID` but never loaded `task.Steps`.
`ActionTask.Steps` is not stored in the task row (`xorm:"-"`); it comes
from `action_task_step` and is only filled by `task.LoadAttributes()` /
`GetTaskStepsByTaskID()`. So the conversion loop over `task.Steps`
always saw nil and produced no steps in the API response.

## Solution

After resolving the task (by ID when the caller passes `nil`), we now
load its steps with `GetTaskStepsByTaskID(ctx, task.ID)` and set
`task.Steps` before building the API steps slice. No other behavior is
changed.

## Testing

- New integration test `TestAPIListWorkflowRunJobsReturnsSteps`: calls
the runs/{runId}/jobs endpoint, inserts a task step for a fixture job,
and asserts that the response includes non-null, non-empty `steps` with
the expected step data.
- `make test-sqlite#TestAPIListWorkflowRunJobsReturnsSteps` passes with
this fix.

---------

Co-authored-by: Manav <mdave0905@gmail.com>
2026-02-13 08:16:43 +00:00
..
2025-01-09 15:15:47 +08:00
2025-03-10 17:36:02 +08:00
2025-03-10 17:36:02 +08:00
2025-03-10 17:36:02 +08:00