mirror of
https://github.com/go-gitea/gitea
synced 2025-07-28 05:08:37 +00:00
Send email on Workflow Run Success/Failure (#34982)
Closes #23725   /claim #23725 --------- Signed-off-by: NorthRealm <155140859+NorthRealm@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: ChristopherHX <christopher.homberger@web.de>
This commit is contained in:
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
|
33
templates/mail/notify/workflow_run.tmpl
Normal file
33
templates/mail/notify/workflow_run.tmpl
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
|
||||
<title>{{.Subject}}</title>
|
||||
</head>
|
||||
<body style="background-color: #f5f7fa; margin: 20px;">
|
||||
|
||||
<h2 style="color: #2c3e50; margin-bottom: 20px;">
|
||||
{{.Repo.FullName}} {{.Run.WorkflowID}}: {{.RunStatusText}}
|
||||
</h2>
|
||||
|
||||
<ul style="list-style: none; padding: 0; margin: 0 0 30px 0;">
|
||||
{{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;">
|
||||
<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}}
|
||||
</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
|
||||
<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;">
|
||||
{{.locale.Tr "mail.view_it_on" AppName}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -29,6 +29,37 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .EnableActions}}
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "actions.actions"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<div class="ui list flex-items-block">
|
||||
<div class="item">
|
||||
<form class="ui form tw-w-full" action="{{AppSubUrl}}/user/settings/notifications/actions" method="post">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<div class="field">
|
||||
<label>{{ctx.Locale.Tr "settings.email_notifications.actions.desc" "https://docs.gitea.com/usage/actions/overview/"}}</label>
|
||||
<div class="ui selection dropdown">
|
||||
<input name="preference" type="hidden" value="{{.ActionsEmailNotificationsPreference}}">
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
<div class="text"></div>
|
||||
<div class="menu">
|
||||
<div data-value="all" class="item">{{ctx.Locale.Tr "all"}}</div>
|
||||
<div data-value="failure-only" class="item">{{ctx.Locale.Tr "settings.email_notifications.actions.failure_only"}}</div>
|
||||
<div data-value="disabled" class="item">{{ctx.Locale.Tr "disabled"}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<button class="ui primary button">{{ctx.Locale.Tr "settings.email_notifications.submit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{template "user/settings/layout_footer" .}}
|
||||
|
Reference in New Issue
Block a user