Skip to content

Commit 2fa624a

Browse files
committed
fix merge
1 parent 9da6b36 commit 2fa624a

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

routers/web/devtest/mail_preview.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func MailPreviewRender(ctx *context.Context) {
1818
tmplName := ctx.PathParam("*")
19-
mockDataContent, err := templates.AssetFS().ReadFile("mail/" + tmplName + ".mock.yml")
19+
mockDataContent, err := templates.AssetFS().ReadFile("mail/" + tmplName + ".devtest.yml")
2020
mockData := map[string]any{}
2121
if err == nil {
2222
err = yaml.Unmarshal(mockDataContent, &mockData)

services/mailer/mail_workflow_run.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ func sendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Rep
5454
return
5555
}
5656
sort.SliceStable(jobs, func(i, j int) bool {
57-
si := jobs[i].Status
58-
sj := jobs[j].Status
59-
return !(si == sj || si.IsSuccess()) && si < sj
57+
si, sj := jobs[i].Status, jobs[j].Status
58+
if si != sj || sj.IsSuccess() /* if not equal, then success is the max */ {
59+
return true
60+
}
61+
return si < sj
6062
})
6163

6264
convertedJobs := make([]convertedWorkflowJob, 0, len(jobs))
@@ -96,7 +98,7 @@ func sendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Rep
9698
runStatusText = "All jobs have been cancelled"
9799
}
98100
var mailBody bytes.Buffer
99-
if err := bodyTemplates.ExecuteTemplate(&mailBody, tplWorkflowRun, map[string]any{
101+
if err := LoadedTemplates().BodyTemplates.ExecuteTemplate(&mailBody, tplWorkflowRun, map[string]any{
100102
"Subject": subject,
101103
"Repo": repo,
102104
"Run": run,
File renamed without changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
RunStatusText: run status text ....
2+
3+
Repo:
4+
FullName: RepoName
5+
6+
Run:
7+
WorkflowID: WorkflowID
8+
HTMLURL: http://localhost/run/1
9+
10+
Jobs:
11+
- Name: Job-Name-1
12+
Status: success
13+
Attempt: 1
14+
HTMLURL: http://localhost/job/1
15+
- Name: Job-Name-2
16+
Status: failed
17+
Attempt: 2
18+
HTMLURL: http://localhost/job/2

templates/mail/notify/workflow_run.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<ul style="list-style: none; padding: 0; margin: 0 0 30px 0;">
1515
{{range $job := .Jobs}}
1616
<li style="background-color: #ffffff; border: 1px solid #ddd; border-radius: 6px; padding: 12px 16px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); transition: box-shadow 0.2s ease;">
17-
<a href="{{$job.HTMLURL}}" style="color: #0073e6; text-decoration: none; font-weight: bold;" onmouseover="this.style.textDecoration='underline'" onmouseout="this.style.textDecoration='none'">
17+
<a href="{{$job.HTMLURL}}" style="color: #0073e6; text-decoration: none; font-weight: bold;">
1818
{{$job.Status}}: {{$job.Name}}{{if gt $job.Attempt 1}}, Attempt #{{$job.Attempt}}{{end}}
1919
</a>
2020
</li>
@@ -24,7 +24,7 @@
2424
<br/>
2525

2626
<div style="text-align: center; margin-top: 30px;">
27-
<a href="{{.Run.HTMLURL}}" style="display: inline-block; background-color: #28a745; color: #ffffff !important; text-decoration: none; padding: 10px 20px; border-radius: 5px; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: background-color 0.3s ease;" onmouseover="this.style.backgroundColor='#218838'" onmouseout="this.style.backgroundColor='#28a745'">
27+
<a href="{{.Run.HTMLURL}}" style="display: inline-block; background-color: #28a745; color: #ffffff !important; text-decoration: none; padding: 10px 20px; border-radius: 5px; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: background-color 0.3s ease;">
2828
{{.locale.Tr "mail.view_it_on" AppName}}
2929
</a>
3030
</div>

0 commit comments

Comments
 (0)