fix: nil pointer access ( workflow_dispatch )
This commit is contained in:
parent
cf00e8d9bb
commit
d97481d567
5 changed files with 50 additions and 9 deletions
pkg/runner
expression.gorunner_test.go
testdata
workflow_dispatch-scalar-composite-action
workflow_dispatch-scalar
workflow_dispatch_no_inputs_mapping
|
@ -331,15 +331,17 @@ func getEvaluatorInputs(ctx context.Context, rc *RunContext, step step, ghc *mod
|
||||||
|
|
||||||
if ghc.EventName == "workflow_dispatch" {
|
if ghc.EventName == "workflow_dispatch" {
|
||||||
config := rc.Run.Workflow.WorkflowDispatchConfig()
|
config := rc.Run.Workflow.WorkflowDispatchConfig()
|
||||||
for k, v := range config.Inputs {
|
if config != nil && config.Inputs != nil {
|
||||||
value := nestedMapLookup(ghc.Event, "inputs", k)
|
for k, v := range config.Inputs {
|
||||||
if value == nil {
|
value := nestedMapLookup(ghc.Event, "inputs", k)
|
||||||
value = v.Default
|
if value == nil {
|
||||||
}
|
value = v.Default
|
||||||
if v.Type == "boolean" {
|
}
|
||||||
inputs[k] = value == "true"
|
if v.Type == "boolean" {
|
||||||
} else {
|
inputs[k] = value == "true"
|
||||||
inputs[k] = value
|
} else {
|
||||||
|
inputs[k] = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,9 @@ func TestRunEvent(t *testing.T) {
|
||||||
{workdir, "evalenv", "push", "", platforms},
|
{workdir, "evalenv", "push", "", platforms},
|
||||||
{workdir, "ensure-post-steps", "push", "Job 'second-post-step-should-fail' failed", platforms},
|
{workdir, "ensure-post-steps", "push", "Job 'second-post-step-should-fail' failed", platforms},
|
||||||
{workdir, "workflow_dispatch", "workflow_dispatch", "", 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
|
{"../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
|
// {"testdata", "issue-228", "push", "", platforms, }, // TODO [igni]: Remove this once everything passes
|
||||||
{"../model/testdata", "container-volumes", "push", "", platforms},
|
{"../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…
Add table
Reference in a new issue