1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 18:58:38 +00:00
Files
gitea/routers/api/v1/repo/actions_run.go
AlexMaryW c10c4203ee Add owner and parent fields clarification to docs (#35023)
Issue: https://github.com/go-gitea/gitea/issues/9637

Changes introduced: I have clarified the problematic terms (owner and
parent) in all affected endpoints.

The changes were made to relevant:

- HTTP endpoint parameters' descriptions
- response/request models' fields

This MR is big, but most changes are the same. If you'd like me to break
this MR into several smaller ones, let me know :)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-23 06:44:34 +00:00

65 lines
1.5 KiB
Go

// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repo
import (
"errors"
actions_model "code.gitea.io/gitea/models/actions"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/routers/common"
"code.gitea.io/gitea/services/context"
)
func DownloadActionsRunJobLogs(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs repository downloadActionsRunJobLogs
// ---
// summary: Downloads the job logs for a workflow run
// produces:
// - application/json
// parameters:
// - name: owner
// in: path
// description: owner of the repo
// type: string
// required: true
// - name: repo
// in: path
// description: name of the repository
// type: string
// required: true
// - name: job_id
// in: path
// description: id of the job
// type: integer
// required: true
// responses:
// "200":
// description: output blob content
// "400":
// "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
jobID := ctx.PathParamInt64("job_id")
curJob, err := actions_model.GetRunJobByID(ctx, jobID)
if err != nil {
ctx.APIErrorInternal(err)
return
}
if err = curJob.LoadRepo(ctx); err != nil {
ctx.APIErrorInternal(err)
return
}
err = common.DownloadActionsRunJobLogs(ctx.Base, ctx.Repo.Repository, curJob)
if err != nil {
if errors.Is(err, util.ErrNotExist) {
ctx.APIErrorNotFound(err)
} else {
ctx.APIErrorInternal(err)
}
}
}