Skip to main content

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 to ensure correct message rendering.

Here is an example:

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 -}}

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

Testingโ€‹

After you've completed the Setup you can try out your new notification integration:

Example Issue

๐Ÿ“ **#1 Very Important Issue**  
๐ŸŸข | ๐Ÿ‘ค User
๐Ÿ”— https://gitea.domain.com/user/repo/issues/1

Featuresโ€‹

The provided Message Template currently supports:

  • issues
  • commits
  • pull requests