|
|
|
@ -67,6 +67,9 @@ type ViewResponse struct { |
|
|
|
|
CanRerun bool `json:"canRerun"` |
|
|
|
|
CanDeleteArtifact bool `json:"canDeleteArtifact"` |
|
|
|
|
Done bool `json:"done"` |
|
|
|
|
WorkflowID string `json:"workflowID"` |
|
|
|
|
WorkflowLink string `json:"workflowLink"` |
|
|
|
|
IsSchedule bool `json:"isSchedule"` |
|
|
|
|
Jobs []*ViewJob `json:"jobs"` |
|
|
|
|
Commit ViewCommit `json:"commit"` |
|
|
|
|
} `json:"run"` |
|
|
|
@ -90,12 +93,10 @@ type ViewJob struct { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ViewCommit struct { |
|
|
|
|
LocaleCommit string `json:"localeCommit"` |
|
|
|
|
LocalePushedBy string `json:"localePushedBy"` |
|
|
|
|
ShortSha string `json:"shortSHA"` |
|
|
|
|
Link string `json:"link"` |
|
|
|
|
Pusher ViewUser `json:"pusher"` |
|
|
|
|
Branch ViewBranch `json:"branch"` |
|
|
|
|
ShortSha string `json:"shortSHA"` |
|
|
|
|
Link string `json:"link"` |
|
|
|
|
Pusher ViewUser `json:"pusher"` |
|
|
|
|
Branch ViewBranch `json:"branch"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type ViewUser struct { |
|
|
|
@ -151,6 +152,9 @@ func ViewPost(ctx *context_module.Context) { |
|
|
|
|
resp.State.Run.CanRerun = run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions) |
|
|
|
|
resp.State.Run.CanDeleteArtifact = run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions) |
|
|
|
|
resp.State.Run.Done = run.Status.IsDone() |
|
|
|
|
resp.State.Run.WorkflowID = run.WorkflowID |
|
|
|
|
resp.State.Run.WorkflowLink = run.WorkflowLink() |
|
|
|
|
resp.State.Run.IsSchedule = run.IsSchedule() |
|
|
|
|
resp.State.Run.Jobs = make([]*ViewJob, 0, len(jobs)) // marshal to '[]' instead fo 'null' in json
|
|
|
|
|
resp.State.Run.Status = run.Status.String() |
|
|
|
|
for _, v := range jobs { |
|
|
|
@ -172,12 +176,10 @@ func ViewPost(ctx *context_module.Context) { |
|
|
|
|
Link: run.RefLink(), |
|
|
|
|
} |
|
|
|
|
resp.State.Run.Commit = ViewCommit{ |
|
|
|
|
LocaleCommit: ctx.Locale.TrString("actions.runs.commit"), |
|
|
|
|
LocalePushedBy: ctx.Locale.TrString("actions.runs.pushed_by"), |
|
|
|
|
ShortSha: base.ShortSha(run.CommitSHA), |
|
|
|
|
Link: fmt.Sprintf("%s/commit/%s", run.Repo.Link(), run.CommitSHA), |
|
|
|
|
Pusher: pusher, |
|
|
|
|
Branch: branch, |
|
|
|
|
ShortSha: base.ShortSha(run.CommitSHA), |
|
|
|
|
Link: fmt.Sprintf("%s/commit/%s", run.Repo.Link(), run.CommitSHA), |
|
|
|
|
Pusher: pusher, |
|
|
|
|
Branch: branch, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var task *actions_model.ActionTask |
|
|
|
|