mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-06 17:40:58 +00:00
feat: rename notifications control to enable-email-notifications (#152)
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/152 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
01032808ea
commit
fe19a1d47b
2 changed files with 7 additions and 7 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue