2021-01-15 01:24:03 +02:00
|
|
|
{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
|
2014-08-24 08:59:47 -04:00
|
|
|
<div class="field">
|
2024-08-17 20:24:31 +02:00
|
|
|
<fieldset class="event type">
|
|
|
|
<legend>{{ctx.Locale.Tr "repo.settings.event_desc"}}</legend>
|
2024-08-19 23:35:37 +02:00
|
|
|
<label>
|
2024-08-17 20:24:31 +02:00
|
|
|
<input name="events" type="radio" value="push_only" {{if or $isNew .Webhook.PushOnly}}checked{{end}}>
|
|
|
|
{{ctx.Locale.Tr "repo.settings.event_push_only"}}
|
|
|
|
</label>
|
2024-08-19 23:35:37 +02:00
|
|
|
<label>
|
2024-08-17 20:24:31 +02:00
|
|
|
<input name="events" type="radio" value="send_everything" {{if .Webhook.SendEverything}}checked{{end}}>
|
|
|
|
{{ctx.Locale.Tr "repo.settings.event_send_everything"}}
|
|
|
|
</label>
|
2024-08-19 23:35:37 +02:00
|
|
|
<label>
|
2024-08-17 20:24:31 +02:00
|
|
|
<input name="events" type="radio" value="choose_events" {{if .Webhook.ChooseEvents}}checked{{end}}>
|
|
|
|
{{ctx.Locale.Tr "repo.settings.event_choose"}}
|
|
|
|
</label>
|
2024-08-19 23:35:37 +02:00
|
|
|
<fieldset class="hide-unless-checked">
|
|
|
|
<!-- Repository Events -->
|
|
|
|
<fieldset class="simple-grid grid-2">
|
|
|
|
<legend>{{ctx.Locale.Tr "repo.settings.event_header_repository"}}</legend>
|
|
|
|
<!-- Create -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="create" type="checkbox" {{if .Webhook.Create}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_create"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_create_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Delete -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="delete" type="checkbox" {{if .Webhook.Delete}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_delete"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_delete_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Fork -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="fork" type="checkbox" {{if .Webhook.Fork}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_fork"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_fork_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Push -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="push" type="checkbox" {{if .Webhook.Push}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_push"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_push_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Repository -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="repository" type="checkbox" {{if .Webhook.Repository}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_repository"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_repository_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Release -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="release" type="checkbox" {{if .Webhook.Release}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_release"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_release_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Package -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="package" type="checkbox" {{if .Webhook.Package}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_package"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_package_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Wiki -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="wiki" type="checkbox" {{if .Webhook.Wiki}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_wiki"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_wiki_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
</fieldset>
|
|
|
|
<!-- Issue Events -->
|
|
|
|
<fieldset class="simple-grid grid-2">
|
|
|
|
<legend>{{ctx.Locale.Tr "repo.settings.event_header_issue"}}</legend>
|
|
|
|
<!-- Issues -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="issues" type="checkbox" {{if .Webhook.Issues}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_issues"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issues_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Issue Assign -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_issue_assign"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_assign_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Issue Label -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_issue_label"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_label_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Issue Milestone -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_issue_milestone"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_milestone_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Issue Comment -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_issue_comment"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_comment_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
</fieldset>
|
|
|
|
<!-- Pull Request Events -->
|
|
|
|
<fieldset class="simple-grid grid-2">
|
|
|
|
<legend>{{ctx.Locale.Tr "repo.settings.event_header_pull_request"}}</legend>
|
|
|
|
<!-- Pull Request -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Assign -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_assign"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_assign_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Label -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_label"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_label_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Milestone -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Comment -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_comment"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_comment_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Review -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_review"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Sync -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_sync"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_sync_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
<!-- Pull Request Review Request -->
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="pull_request_review_request" type="checkbox" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}>
|
2024-08-19 23:35:37 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request_desc"}}</span>
|
2024-08-19 23:35:37 +02:00
|
|
|
</label>
|
|
|
|
</fieldset>
|
Actions Failure, Succes, Recover Webhooks (#7508)
Implement Actions Success, Failure and Recover webhooks for Forgejo, Gitea, Gogs, Slack, Discord, DingTalk, Telegram, Microsoft Teams, Feishu / Lark Suite, Matrix, WeCom (Wechat Work), Packagist. Some of these webhooks have not been manually tested.
Implement settings for these new webhooks.
## 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.
- [x] 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/7508): <!--number 7508 --><!--line 0 --><!--description QWN0aW9ucyBGYWlsdXJlLCBTdWNjZXMsIFJlY292ZXIgV2ViaG9va3M=-->Actions Failure, Succes, Recover Webhooks<!--description-->
<!--end release-notes-assistant-->
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7508
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>
2025-06-03 14:29:19 +02:00
|
|
|
<!-- Action Run Events -->
|
|
|
|
<fieldset class="simple-grid grid-2">
|
|
|
|
<legend>{{ctx.Locale.Tr "repo.settings.event_header_action"}}</legend>
|
|
|
|
<!-- Action Run Failure -->
|
|
|
|
<label>
|
|
|
|
<input name="action_failure" type="checkbox" {{if .Webhook.ActionRunFailure}}checked{{end}}>
|
|
|
|
{{ctx.Locale.Tr "repo.settings.event_action_failure"}}
|
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_action_failure_desc"}}</span>
|
|
|
|
</label>
|
|
|
|
<!-- Action Run Recover -->
|
|
|
|
<label>
|
|
|
|
<input name="action_recover" type="checkbox" {{if .Webhook.ActionRunRecover}}checked{{end}}>
|
|
|
|
{{ctx.Locale.Tr "repo.settings.event_action_recover"}}
|
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_action_recover_desc"}}</span>
|
|
|
|
</label>
|
|
|
|
<!-- Action Run Success -->
|
|
|
|
<label>
|
|
|
|
<input name="action_success" type="checkbox" {{if .Webhook.ActionRunSuccess}}checked{{end}}>
|
|
|
|
{{ctx.Locale.Tr "repo.settings.event_action_success"}}
|
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_action_success_desc"}}</span>
|
|
|
|
</label>
|
|
|
|
</fieldset>
|
2024-08-19 23:35:37 +02:00
|
|
|
</fieldset>
|
|
|
|
</fieldset>
|
2014-08-24 08:59:47 -04:00
|
|
|
</div>
|
2015-08-28 23:36:13 +08:00
|
|
|
|
2019-09-09 08:48:21 +03:00
|
|
|
<!-- Branch filter -->
|
|
|
|
<div class="field">
|
2023-09-25 10:56:50 +02:00
|
|
|
<label for="branch_filter">{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label>
|
2024-02-17 16:32:43 +02:00
|
|
|
<input id="branch_filter" name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}">
|
2024-09-02 20:36:24 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</span>
|
2019-09-09 08:48:21 +03:00
|
|
|
</div>
|
|
|
|
|
2024-04-09 11:06:36 +02:00
|
|
|
{{$skipAuthorizationHeader := or (eq .HookType "sourcehut_builds") (eq .HookType "matrix")}}
|
2024-04-08 17:51:39 +02:00
|
|
|
{{if not $skipAuthorizationHeader}}
|
|
|
|
<!-- Authorization Header -->
|
2024-04-09 11:06:36 +02:00
|
|
|
<div class="field {{if .Err_AuthorizationHeader}}error{{end}}">
|
2024-04-08 17:51:39 +02:00
|
|
|
<label for="authorization_header">{{ctx.Locale.Tr "repo.settings.authorization_header"}}</label>
|
2024-04-09 11:06:36 +02:00
|
|
|
<input id="authorization_header" name="authorization_header" type="text" value="{{.Webhook.HeaderAuthorization}}">
|
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" ("<code>Bearer token123456</code>, <code>Basic YWxhZGRpbjpvcGVuc2VzYW1l</code>" | SafeHTML)}}</span>
|
2024-04-08 17:51:39 +02:00
|
|
|
</div>
|
|
|
|
{{end}}
|
2022-11-03 19:23:20 +01:00
|
|
|
|
2023-06-29 14:24:22 +02:00
|
|
|
<div class="divider"></div>
|
2015-08-28 23:36:13 +08:00
|
|
|
|
2024-08-17 20:24:31 +02:00
|
|
|
<fieldset>
|
|
|
|
<label>
|
2023-08-26 10:44:00 +08:00
|
|
|
<input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}>
|
2024-08-17 20:24:31 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.active"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.active_helper"}}</span>
|
2024-08-17 20:24:31 +02:00
|
|
|
</label>
|
2019-03-18 22:33:20 -04:00
|
|
|
{{if $isNew}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</button>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{else}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_webhook"}}</button>
|
|
|
|
<a class="ui red delete-button button" data-url="{{.BaseLink}}/delete" data-id="{{.Webhook.ID}}">{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|
2024-08-17 20:24:31 +02:00
|
|
|
</fieldset>
|
2015-08-27 00:30:06 +08:00
|
|
|
|
2018-05-16 22:01:55 +08:00
|
|
|
{{template "repo/settings/webhook/delete_modal" .}}
|