mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-07-21 22:00:02 +02:00

Send a Mail when an action run fails or a workflow recovers. This PR depends on https://codeberg.org/forgejo/forgejo/pulls/7491 closes #3719 ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [x] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Features - [PR](https://codeberg.org/forgejo/forgejo/pulls/7509): <!--number 7509 --><!--line 0 --><!--description c2VuZCBtYWlsIG9uIGZhaWxlZCBvciByZWNvdmVyZWQgd29ya2Zsb3cgcnVu-->send mail on failed or recovered workflow run<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7509 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: christopher-besch <mail@chris-besch.com> Co-committed-by: christopher-besch <mail@chris-besch.com>
38 lines
1.1 KiB
Go HTML Template
38 lines
1.1 KiB
Go HTML Template
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
.footer { font-size:small; color:#666;}
|
|
</style>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
</head>
|
|
|
|
{{$repo_link := HTMLFormat "<a href='%s'>%s</a>" .Run.Repo.HTMLURL .RepoFullName}}
|
|
{{$action_run_link := HTMLFormat "<a href='%s'>%s</a>" .Link .Run.Title}}
|
|
{{$trigger_user_link := HTMLFormat "<a href='%s'>@%s</a>" .Run.TriggerUser.HTMLURL .Run.TriggerUser.Name}}
|
|
<body>
|
|
<p>
|
|
{{if .IsSuccess}}
|
|
{{.locale.Tr "mail.actions.successful_run_after_failure" $action_run_link $repo_link}}
|
|
{{else}}
|
|
{{.locale.Tr "mail.actions.not_successful_run" $action_run_link $repo_link}}
|
|
{{end}}
|
|
|
|
<br />
|
|
|
|
{{.locale.Tr "mail.actions.run_info_cur_status" .Run.Status .PriorStatus}}<br />
|
|
{{.locale.Tr "mail.actions.run_info_ref" .Branch .CommitSHA}}<br />
|
|
{{if .LastRun}}
|
|
{{.locale.Tr "mail.actions.run_info_previous_status" .LastRun.Status}}<br />
|
|
{{end}}
|
|
{{.locale.Tr "mail.actions.run_info_trigger" .Run.TriggerEvent $trigger_user_link}}
|
|
</p>
|
|
<div class="footer">
|
|
<p>
|
|
---
|
|
<br>
|
|
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>.
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|