mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-03 20:37:02 +02:00
fix merge
This commit is contained in:
parent
9da6b36646
commit
2fa624a32e
@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
func MailPreviewRender(ctx *context.Context) {
|
func MailPreviewRender(ctx *context.Context) {
|
||||||
tmplName := ctx.PathParam("*")
|
tmplName := ctx.PathParam("*")
|
||||||
mockDataContent, err := templates.AssetFS().ReadFile("mail/" + tmplName + ".mock.yml")
|
mockDataContent, err := templates.AssetFS().ReadFile("mail/" + tmplName + ".devtest.yml")
|
||||||
mockData := map[string]any{}
|
mockData := map[string]any{}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = yaml.Unmarshal(mockDataContent, &mockData)
|
err = yaml.Unmarshal(mockDataContent, &mockData)
|
||||||
|
@ -54,9 +54,11 @@ func sendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Rep
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
sort.SliceStable(jobs, func(i, j int) bool {
|
sort.SliceStable(jobs, func(i, j int) bool {
|
||||||
si := jobs[i].Status
|
si, sj := jobs[i].Status, jobs[j].Status
|
||||||
sj := jobs[j].Status
|
if si != sj || sj.IsSuccess() /* if not equal, then success is the max */ {
|
||||||
return !(si == sj || si.IsSuccess()) && si < sj
|
return true
|
||||||
|
}
|
||||||
|
return si < sj
|
||||||
})
|
})
|
||||||
|
|
||||||
convertedJobs := make([]convertedWorkflowJob, 0, len(jobs))
|
convertedJobs := make([]convertedWorkflowJob, 0, len(jobs))
|
||||||
@ -96,7 +98,7 @@ func sendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Rep
|
|||||||
runStatusText = "All jobs have been cancelled"
|
runStatusText = "All jobs have been cancelled"
|
||||||
}
|
}
|
||||||
var mailBody bytes.Buffer
|
var mailBody bytes.Buffer
|
||||||
if err := bodyTemplates.ExecuteTemplate(&mailBody, tplWorkflowRun, map[string]any{
|
if err := LoadedTemplates().BodyTemplates.ExecuteTemplate(&mailBody, tplWorkflowRun, map[string]any{
|
||||||
"Subject": subject,
|
"Subject": subject,
|
||||||
"Repo": repo,
|
"Repo": repo,
|
||||||
"Run": run,
|
"Run": run,
|
||||||
|
18
templates/mail/notify/workflow_run.devtest.yml
Normal file
18
templates/mail/notify/workflow_run.devtest.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
RunStatusText: run status text ....
|
||||||
|
|
||||||
|
Repo:
|
||||||
|
FullName: RepoName
|
||||||
|
|
||||||
|
Run:
|
||||||
|
WorkflowID: WorkflowID
|
||||||
|
HTMLURL: http://localhost/run/1
|
||||||
|
|
||||||
|
Jobs:
|
||||||
|
- Name: Job-Name-1
|
||||||
|
Status: success
|
||||||
|
Attempt: 1
|
||||||
|
HTMLURL: http://localhost/job/1
|
||||||
|
- Name: Job-Name-2
|
||||||
|
Status: failed
|
||||||
|
Attempt: 2
|
||||||
|
HTMLURL: http://localhost/job/2
|
@ -14,7 +14,7 @@
|
|||||||
<ul style="list-style: none; padding: 0; margin: 0 0 30px 0;">
|
<ul style="list-style: none; padding: 0; margin: 0 0 30px 0;">
|
||||||
{{range $job := .Jobs}}
|
{{range $job := .Jobs}}
|
||||||
<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;">
|
<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;">
|
||||||
<a href="{{$job.HTMLURL}}" style="color: #0073e6; text-decoration: none; font-weight: bold;" onmouseover="this.style.textDecoration='underline'" onmouseout="this.style.textDecoration='none'">
|
<a href="{{$job.HTMLURL}}" style="color: #0073e6; text-decoration: none; font-weight: bold;">
|
||||||
{{$job.Status}}: {{$job.Name}}{{if gt $job.Attempt 1}}, Attempt #{{$job.Attempt}}{{end}}
|
{{$job.Status}}: {{$job.Name}}{{if gt $job.Attempt 1}}, Attempt #{{$job.Attempt}}{{end}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<div style="text-align: center; margin-top: 30px;">
|
<div style="text-align: center; margin-top: 30px;">
|
||||||
<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'">
|
<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;">
|
||||||
{{.locale.Tr "mail.view_it_on" AppName}}
|
{{.locale.Tr "mail.view_it_on" AppName}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user