From fe19a1d47b087db3dd950e640e9da53882de881e Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 17 Jun 2025 08:55:44 +0000 Subject: [PATCH] feat: rename notifications control to enable-email-notifications (#152) Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/152 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- act/model/workflow.go | 6 +++--- act/model/workflow_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/act/model/workflow.go b/act/model/workflow.go index 54c33983..96e41be8 100644 --- a/act/model/workflow.go +++ b/act/model/workflow.go @@ -22,7 +22,7 @@ type Workflow struct { Jobs map[string]*Job `yaml:"jobs"` Defaults Defaults `yaml:"defaults"` - RawNotifications yaml.Node `yaml:"notifications"` + RawNotifications yaml.Node `yaml:"enable-email-notifications"` } // On events for the workflow @@ -772,10 +772,10 @@ func (w *Workflow) Notifications() (bool, error) { var val bool err := w.RawNotifications.Decode(&val) if err != nil { - return false, fmt.Errorf("notifications: failed to decode: %v", w.RawNotifications.Kind) + return false, fmt.Errorf("enable-email-notifications: failed to decode: %v", w.RawNotifications.Kind) } return val, nil default: - return false, fmt.Errorf("notifications: unknown type: %v", w.RawNotifications.Kind) + return false, fmt.Errorf("enable-email-notifications: unknown type: %v", w.RawNotifications.Kind) } } diff --git a/act/model/workflow_test.go b/act/model/workflow_test.go index 45cce2ea..9f2d2c31 100644 --- a/act/model/workflow_test.go +++ b/act/model/workflow_test.go @@ -123,20 +123,20 @@ func TestReadWorkflow_Notifications(t *testing.T) { { expected: true, hasErr: false, - snippet: "notifications: true", + snippet: "enable-email-notifications: true", }, { expected: false, hasErr: false, - snippet: "notifications: false", + snippet: "enable-email-notifications: false", }, { hasErr: true, - snippet: "notifications: invalid", + snippet: "enable-email-notifications: invalid", }, { hasErr: true, - snippet: "notifications: [1,2]", + snippet: "enable-email-notifications: [1,2]", }, } { t.Run(testCase.snippet, func(t *testing.T) {