mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
fix: jobparser: do not crash on invalid workflow_{dispatch,call} (#193)
An invalid workflow_{dispatch,call} key with a type that is not a map may attempt to use a nil map. It happens randomly as the order of the key maps is not guaranteed. Without this fix, the tests will fail 100% of the time with: `go test -count=500 -run=TestParseRawOn/on:___workflow_ -v ./pkg/jobparser/` Regression from https://code.forgejo.org/forgejo/act/pulls/45 Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/193 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
53e26e56b1
commit
6e4a3b5127
2 changed files with 22 additions and 3 deletions
|
@ -190,7 +190,14 @@ func TestParseRawOn(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
input: "on:\n workflow_dispatch:\n inputs:\n test:\n type: string",
|
||||
input: `
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test:
|
||||
type: string
|
||||
silently: ignore
|
||||
`,
|
||||
result: []*Event{
|
||||
{
|
||||
Name: "workflow_dispatch",
|
||||
|
@ -198,7 +205,17 @@ func TestParseRawOn(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
input: "on:\n workflow_call:\n inputs:\n test:\n type: string\n outputs:\n output:\n value: something",
|
||||
input: `
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
test:
|
||||
type: string
|
||||
outputs:
|
||||
output:
|
||||
value: something
|
||||
silently: ignore
|
||||
`,
|
||||
result: []*Event{
|
||||
{
|
||||
Name: "workflow_call",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue