mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
feat: add enable-email-notifications to the schema
This commit is contained in:
parent
5faf1bbc54
commit
960b552ba9
2 changed files with 12 additions and 14 deletions
|
@ -112,32 +112,25 @@ jobs:
|
|||
func TestReadWorkflow_Notifications(t *testing.T) {
|
||||
for _, testCase := range []struct {
|
||||
expected bool
|
||||
hasErr bool
|
||||
err string
|
||||
snippet string
|
||||
}{
|
||||
{
|
||||
expected: false,
|
||||
hasErr: false,
|
||||
snippet: "# nothing",
|
||||
},
|
||||
{
|
||||
expected: true,
|
||||
hasErr: false,
|
||||
snippet: "enable-email-notifications: true",
|
||||
},
|
||||
{
|
||||
expected: false,
|
||||
hasErr: false,
|
||||
snippet: "enable-email-notifications: false",
|
||||
},
|
||||
{
|
||||
hasErr: true,
|
||||
err: "`invalid` into bool",
|
||||
snippet: "enable-email-notifications: invalid",
|
||||
},
|
||||
{
|
||||
hasErr: true,
|
||||
snippet: "enable-email-notifications: [1,2]",
|
||||
},
|
||||
} {
|
||||
t.Run(testCase.snippet, func(t *testing.T) {
|
||||
yaml := fmt.Sprintf(`
|
||||
|
@ -154,12 +147,12 @@ jobs:
|
|||
`, testCase.snippet)
|
||||
|
||||
workflow, err := ReadWorkflow(strings.NewReader(yaml))
|
||||
if testCase.err != "" {
|
||||
assert.ErrorContains(t, err, testCase.err)
|
||||
} else {
|
||||
assert.NoError(t, err, "read workflow should succeed")
|
||||
|
||||
notification, err := workflow.Notifications()
|
||||
if testCase.hasErr {
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, testCase.expected, notification)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"properties": {
|
||||
"on": "on",
|
||||
"name": "workflow-name",
|
||||
"enable-email-notifications": "workflow-enable-email-notifications",
|
||||
"run-name": "run-name",
|
||||
"defaults": "workflow-defaults",
|
||||
"env": "workflow-env",
|
||||
|
@ -44,6 +45,10 @@
|
|||
"description": "The name of the workflow that GitHub displays on your repository's 'Actions' tab.\n\n[Documentation](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#name)",
|
||||
"string": {}
|
||||
},
|
||||
"workflow-enable-email-notifications": {
|
||||
"description": "Send an email notification when a workflow run fails.\n\n[Documentation](https://forgejo.org/docs/next/user/actions/#enable-email-notifications)",
|
||||
"boolean": {}
|
||||
},
|
||||
"run-name": {
|
||||
"context": ["github", "inputs", "vars"],
|
||||
"string": {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue