-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
/
Copy pathactions_run.go
58 lines (53 loc) · 1.4 KB
/
actions_run.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repo
import (
actions_model "code.gitea.io/gitea/models/actions"
"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 logs for a workflow run redirects to blob url
// produces:
// - application/json
// parameters:
// - name: owner
// in: path
// description: name of the owner
// 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")
if jobID == 0 {
ctx.APIError(400, "invalid job id")
return
}
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
}
common.DownloadActionsRunJobLogs(ctx.Base, ctx.Repo.Repository, curJob)
}