fix: nil pointer access ( workflow_dispatch )
This commit is contained in:
parent
cf00e8d9bb
commit
d97481d567
5 changed files with 50 additions and 9 deletions
|
@ -331,15 +331,17 @@ func getEvaluatorInputs(ctx context.Context, rc *RunContext, step step, ghc *mod
|
|||
|
||||
if ghc.EventName == "workflow_dispatch" {
|
||||
config := rc.Run.Workflow.WorkflowDispatchConfig()
|
||||
for k, v := range config.Inputs {
|
||||
value := nestedMapLookup(ghc.Event, "inputs", k)
|
||||
if value == nil {
|
||||
value = v.Default
|
||||
}
|
||||
if v.Type == "boolean" {
|
||||
inputs[k] = value == "true"
|
||||
} else {
|
||||
inputs[k] = value
|
||||
if config != nil && config.Inputs != nil {
|
||||
for k, v := range config.Inputs {
|
||||
value := nestedMapLookup(ghc.Event, "inputs", k)
|
||||
if value == nil {
|
||||
value = v.Default
|
||||
}
|
||||
if v.Type == "boolean" {
|
||||
inputs[k] = value == "true"
|
||||
} else {
|
||||
inputs[k] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,9 @@ func TestRunEvent(t *testing.T) {
|
|||
{workdir, "evalenv", "push", "", platforms},
|
||||
{workdir, "ensure-post-steps", "push", "Job 'second-post-step-should-fail' failed", platforms},
|
||||
{workdir, "workflow_dispatch", "workflow_dispatch", "", platforms},
|
||||
{workdir, "workflow_dispatch_no_inputs_mapping", "workflow_dispatch", "", platforms},
|
||||
{workdir, "workflow_dispatch-scalar", "workflow_dispatch", "", platforms},
|
||||
{workdir, "workflow_dispatch-scalar-composite-action", "workflow_dispatch", "", platforms},
|
||||
{"../model/testdata", "strategy", "push", "", platforms}, // TODO: move all testdata into pkg so we can validate it with planner and runner
|
||||
// {"testdata", "issue-228", "push", "", platforms, }, // TODO [igni]: Remove this once everything passes
|
||||
{"../model/testdata", "container-volumes", "push", "", platforms},
|
||||
|
|
17
pkg/runner/testdata/workflow_dispatch-scalar-composite-action/workflow_dispatch.yml
vendored
Normal file
17
pkg/runner/testdata/workflow_dispatch-scalar-composite-action/workflow_dispatch.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
name: workflow_dispatch
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: |
|
||||
exit 0
|
||||
shell: bash
|
||||
shell: cp {0} action.yml
|
||||
- uses: ./
|
9
pkg/runner/testdata/workflow_dispatch-scalar/workflow_dispatch.yml
vendored
Normal file
9
pkg/runner/testdata/workflow_dispatch-scalar/workflow_dispatch.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
name: workflow_dispatch
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: exit 0
|
10
pkg/runner/testdata/workflow_dispatch_no_inputs_mapping/workflow_dispatch.yml
vendored
Normal file
10
pkg/runner/testdata/workflow_dispatch_no_inputs_mapping/workflow_dispatch.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: workflow_dispatch
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: exit 0
|
Loading…
Reference in a new issue