diff --git a/docs/integrations/gitea/gitea.md b/docs/integrations/gitea/gitea.md new file mode 100644 index 00000000..481f077b --- /dev/null +++ b/docs/integrations/gitea/gitea.md @@ -0,0 +1,47 @@ +--- +title: Gitea +--- + +# Gitea + +Here's how you can use **Secured Signal API** as a notification service for gitea. + +## Setup + +### 1. Message Template + +Because gitea's webhook data is very _clustered_, we need to use [**Message Templates**](../../configuration/message-template) to ensure correct message rendering. + +Here is an example: + +```yaml +{{{ #://./message-template.yml }}} +``` + +Add this to your token config and modify it to your needs. + +### 2. Webhook + +Head to your gitea repository (or user settings) and go to `Settings > Webhooks` and create a new Gitea webhook. + +![Webhook](/integrations/gitea/webhook.png) + +## Testing + +After you've completed the Setup you can try out your new notification integration: + +![Example Issue](/integrations/gitea/issue.png) + +```markdown +๐Ÿ“ **#1 Very Important Issue** +๐ŸŸข | ๐Ÿ‘ค User +๐Ÿ”— https://gitea.domain.com/user/repo/issues/1 +``` + +## Features + +The provided Message Template currently supports: + +- issues +- commits +- pull requests diff --git a/docs/integrations/gitea/message-template.yml b/docs/integrations/gitea/message-template.yml new file mode 100644 index 00000000..7832ff59 --- /dev/null +++ b/docs/integrations/gitea/message-template.yml @@ -0,0 +1,34 @@ +settings: + message: + template: | + {{- if and @issue (ne @issue nil) (not @is_pull) -}} + ๐Ÿ“ **#{{@issue.number}} {{@issue.title}}** + {{ if eq @issue.state "open" -}}๐ŸŸข{{- else if eq @issue.state "closed" -}}๐Ÿ”ด{{- else -}}{{@issue.state}}{{- end }} | ๐Ÿ‘ค {{@sender.full_name}} + ๐Ÿ”— {{@issue.html_url}} + {{- end -}} + + {{- if and @pull_request (ne @pull_request nil) -}} + ๐Ÿš€ **#{{@pull_request.number}} {{@pull_request.title}}** + {{ if eq @pull_request.state "open" -}}๐ŸŸข{{- else if eq @pull_request.state "closed" -}}๐Ÿ”ด{{- else if eq @pull_request.state "merged" -}}๐ŸŸฃ{{- else -}}{{@pull_request.state}}{{- end }} | ๐Ÿ‘ค {{@sender.full_name}} + ๐Ÿ”— {{@pull_request.html_url}} + {{- end -}} + + {{- if and @commits (gt (len @commits) 0) }} + ๐Ÿ“ฅ๏ธ **Push** โ†’ *{{@ref}}* + ๐Ÿ“ {{@repository.full_name}} | ๐Ÿ‘ค {{@pusher.full_name}} | ๐Ÿ”ข {{@total_commits}} + {{- range @commits }} + - ๐Ÿงพ *{{.message}}* + {{- if .added }} + {{- range .added }}โž• {{.}} {{- end }} + {{- end -}} + {{- if .modified }} + {{- range .modified }} โœ๏ธ {{.}} {{- end }} + {{- end -}} + {{- if .removed }} + {{- range .removed }} โŒ {{.}} {{- end }} + {{- end }} + ๐Ÿ”— {{.url}} + {{- end }} + + ๐Ÿ”Ž Compare: {{@compare_url}} + {{- end -}} diff --git a/static/integrations/gitea/issue.png b/static/integrations/gitea/issue.png new file mode 100644 index 00000000..2756706e Binary files /dev/null and b/static/integrations/gitea/issue.png differ diff --git a/static/integrations/gitea/webhook.png b/static/integrations/gitea/webhook.png new file mode 100644 index 00000000..2b5083ad Binary files /dev/null and b/static/integrations/gitea/webhook.png differ