Notify on failed runs and with ntfy disabled

This commit is contained in:
2026-11-12 01:55:28 +00:00
parent 2330f50268
commit 7b1b91f452
10 changed files with 78 additions and 37 deletions
+9 -5
View File
@@ -229,8 +229,8 @@ func runAttentionEvent(status string) string {
switch strings.TrimSpace(strings.ToLower(status)) {
case protocol.RunStatusWaiting:
return protocol.NotifyWaiting
case "failed":
return "failed"
case "failed", "interrupted":
return strings.TrimSpace(strings.ToLower(status))
}
return ""
}
@@ -375,9 +375,9 @@ func (r *runner) notifyRun(id int64, name, status string, sequence int, currentS
if event == "" {
return
}
// A run's end notifies only runs marked "on", unless the operator opted
// into every run end (run_finished); waiting notifies any non-off run.
if event != protocol.NotifyWaiting && r.notifyMode(id) != "on" {
// Failed or interrupted runs always notify; successful runs notify only when
// marked "on" or when the operator opted into every run end (run_finished).
if event == "succeeded" || (event != protocol.NotifyWaiting && event != "failed" && event != "interrupted") {
settings, err := r.store.NotificationSettings(r.ctx)
if err != nil || !settings.RunFinished {
return
@@ -392,6 +392,10 @@ func (r *runner) notifyRun(id int64, name, status string, sequence int, currentS
title = "Run failed"
summary = fmt.Sprintf("Run #%d · %s · run failed", id, name)
}
if event == "interrupted" {
title = "Run interrupted"
summary = fmt.Sprintf("Run #%d · %s · run interrupted", id, name)
}
if event == "succeeded" {
title = "Run succeeded"
summary = fmt.Sprintf("Run #%d · %s · run succeeded", id, name)