From 2dc0122873d9eb6a3cd2eadc33e9b15f61ada289 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 12 Nov 2023 20:56:37 +0100 Subject: [PATCH] Update notifications.md (#1842) --- docs/notifications.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/notifications.md b/docs/notifications.md index fae3710..d5da4fe 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -57,6 +57,10 @@ outputs timestamp and log level. custom format. i.e., The day of the year has to be 1, the month has to be 2 (february), the hour 3 (or 15 for 24h time) etc. +!!! note "Skipping notifications" + To skip sending notifications that do not contain any information, you can wrap your template with `{{if .}}` and `{{end}}`. + + Example: ```bash @@ -101,7 +105,7 @@ It will be used to send a summary of every session if there are any containers t Whenever the result of applying the template results in an empty string, no notifications will be sent. This is by default used to limit the notifications to only be sent when there something noteworthy occurred. - You can replace `{{- if ( or .Updated .Failed ) -}}` with any logic you want to decide when to send the notifications. To skip all empty inputs, you can wrap your template with `{{if .}}` and `{{end}}`. + You can replace `{{- if ( or .Updated .Failed ) -}}` with any logic you want to decide when to send the notifications. Example using a custom report template that always sends a session report after each run: