1
1
mirror of https://github.com/nektos/act.git synced 2024-09-21 01:16:26 +03:00

fix: nil pointer access ( workflow_dispatch )

This commit is contained in:
ChristopherHX 2022-11-10 21:16:00 +01:00 committed by GitHub
parent cf00e8d9bb
commit d97481d567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 9 deletions

View File

@ -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
}
}
}
}

View File

@ -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},

View 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: ./

View File

@ -0,0 +1,9 @@
name: workflow_dispatch
on: workflow_dispatch
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: exit 0

View File

@ -0,0 +1,10 @@
name: workflow_dispatch
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: exit 0