9
9
"context"
10
10
"errors"
11
11
"fmt"
12
+ "html/template"
12
13
"io"
13
14
"net/http"
14
15
"net/url"
@@ -29,6 +30,7 @@ import (
29
30
"code.gitea.io/gitea/modules/setting"
30
31
"code.gitea.io/gitea/modules/storage"
31
32
api "code.gitea.io/gitea/modules/structs"
33
+ "code.gitea.io/gitea/modules/templates"
32
34
"code.gitea.io/gitea/modules/timeutil"
33
35
"code.gitea.io/gitea/modules/util"
34
36
"code.gitea.io/gitea/modules/web"
@@ -87,19 +89,20 @@ type ViewResponse struct {
87
89
88
90
State struct {
89
91
Run struct {
90
- Link string `json:"link"`
91
- Title string `json:"title"`
92
- Status string `json:"status"`
93
- CanCancel bool `json:"canCancel"`
94
- CanApprove bool `json:"canApprove"` // the run needs an approval and the doer has permission to approve
95
- CanRerun bool `json:"canRerun"`
96
- CanDeleteArtifact bool `json:"canDeleteArtifact"`
97
- Done bool `json:"done"`
98
- WorkflowID string `json:"workflowID"`
99
- WorkflowLink string `json:"workflowLink"`
100
- IsSchedule bool `json:"isSchedule"`
101
- Jobs []* ViewJob `json:"jobs"`
102
- Commit ViewCommit `json:"commit"`
92
+ Link string `json:"link"`
93
+ Title string `json:"title"`
94
+ TitleHTML template.HTML `json:"titleHTML"`
95
+ Status string `json:"status"`
96
+ CanCancel bool `json:"canCancel"`
97
+ CanApprove bool `json:"canApprove"` // the run needs an approval and the doer has permission to approve
98
+ CanRerun bool `json:"canRerun"`
99
+ CanDeleteArtifact bool `json:"canDeleteArtifact"`
100
+ Done bool `json:"done"`
101
+ WorkflowID string `json:"workflowID"`
102
+ WorkflowLink string `json:"workflowLink"`
103
+ IsSchedule bool `json:"isSchedule"`
104
+ Jobs []* ViewJob `json:"jobs"`
105
+ Commit ViewCommit `json:"commit"`
103
106
} `json:"run"`
104
107
CurrentJob struct {
105
108
Title string `json:"title"`
@@ -200,7 +203,10 @@ func ViewPost(ctx *context_module.Context) {
200
203
}
201
204
}
202
205
206
+ metas := ctx .Repo .Repository .ComposeMetas (ctx )
207
+
203
208
resp .State .Run .Title = run .Title
209
+ resp .State .Run .TitleHTML = templates .NewRenderUtils (ctx ).RenderCommitMessage (run .Title , metas )
204
210
resp .State .Run .Link = run .Link ()
205
211
resp .State .Run .CanCancel = ! run .Status .IsDone () && ctx .Repo .CanWrite (unit .TypeActions )
206
212
resp .State .Run .CanApprove = run .NeedApproval && ctx .Repo .CanWrite (unit .TypeActions )
0 commit comments