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
..
e2e chore: add comments for "api/healthz", clean up test env (#36481) 2026-01-30 10:23:38 +08:00
fuzz
gitea-lfs-meta
gitea-repositories-meta Fix corrupted external render content (#35946) 2025-11-14 08:31:11 +08:00
integration BUG: Fix workflow run jobs API returning null steps (#36603) 2026-02-13 08:16:43 +00:00
testdata/data
mssql.ini.tmpl Fix LFS URL (#33840) 2025-03-10 17:36:02 +08:00
mysql.ini.tmpl Fix LFS URL (#33840) 2025-03-10 17:36:02 +08:00
pgsql.ini.tmpl Fix LFS URL (#33840) 2025-03-10 17:36:02 +08:00
sqlite.ini.tmpl Fix corrupted external render content (#35946) 2025-11-14 08:31:11 +08:00
test_utils.go chore: add comments for "api/healthz", clean up test env (#36481) 2026-01-30 10:23:38 +08:00