Repository: nektos/act (language: go)

Issue:
Nil reference when using workflow_dispatch
### Bug report info

```plain text
act version:            v0.2.27-dev
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 14
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
	\\.\pipe\docker_engine
Config files:           
	C:\Users\veleek\.actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.19.2
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-compiler:            gc
		CGO_ENABLED:          1
		CGO_CFLAGS:           
		CGO_CPPFLAGS:         
		CGO_CXXFLAGS:         
		CGO_LDFLAGS:          
		GOARCH:               amd64
		GOOS:                 windows
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         b0f64506638be35e385890cff77b57c717336edb
		vcs.time:             2022-11-02T17:12:16Z
		vcs.modified:         false
Docker Engine:
	Engine version:        20.10.17
	Engine runtime:        runc
	Cgroup version:        1
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:            
	OS arch:               x86_64
	OS kernel:             5.10.102.1-microsoft-standard-WSL2
	OS CPU:                14
	OS memory:             12771 MB
	Security options:
		name=seccomp,profile=default
```


### Command used with act

```sh
act workflow_dispatch -e payload.json -W .\.github\workflows\test.yml -r -P self-hosted=catthehacker/ubuntu:act-latest -s ACTIONS=$pat -s COMMON_GCR_CREDENTIAL=$c
```


### Describe issue

I'm using a workflow that calls a composite action in the same repository (referenced via `uses: ./.github/action/check-image-exists`).  

When executing the workflow using `workflow_dispatch` everything succeeds up until the point where it calls the composite action.  It ends up calling `runner.getEvaluatorInputs (c:\src\act\pkg\runner\expression.go:333)` a few times.  The last time it calls it, somehow the `workflow.RawOn` property gets cleared out.  As a result, when the code tries to get the inputs from the workflow it returns nil, which then fails.  

This may be expected (that the inputs get cleared out), but it's just not being handled appropriately for the event type.

### Link to GitHub repository

_No response_

### Workflow content

```yml
Testing workflow


name: Testing
on:
  push:
    branches:
      - main
  workflow_dispatch:
    inputs:
      short_sha:
        description: Specify the GCR Short SHA image tag (7 commit digits SHA commit hash)
        required: true

jobs:
  test-step-1:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout default commit
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.ACTIONS }}
          # If the input SHA is empty, this will just default to the SHA for the event that triggered this workflow
          ref: ${{ inputs.short_sha }}

      - name: Get commit tag
        id: commit-tag
        run: |-
          echo "build_tag=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT

      - name: Check if image with tag exists
        id: check_tag
        uses: ./.github/actions/check-image-exists
        with:
          image_name: gcr.io/mp-groups-common/mp-groups
          image_tag: ${{ steps.commit-tag.outputs.build_tag }}




-------------------------------------------------------

Composite action in .github/actions/check-image-exists


name: Check if image a specific image exists
description: Check whether an image with a given tag exists in the container repository
inputs:
  image_name:
    description: The name of the image to check
    required: true
  image_tag:
    description: The tag of the image that should exist
    required: false
    default: 'latest'
  required:
    description: Indicates whether it is required that the image exists.  If this is true, and the image doesn't exist, this step will fail.
    required: false
    default: 'false'
outputs:
  image_exists:
    description: true if an image with the given exists, false otherwise
    value: ${{ steps.verify_image_exists.outputs.image_exists }}
runs:
  using: "composite"
  steps:
    - name: Verify image with tag exists
      id: verify_image_exists
      shell: bash
      run: |-
        filter=""
        image_tag="${{ inputs.image_tag }}"
        if [ "$image_tag" != "" ]; then
          filter="--filter=\"tags:$image_tag\""
        fi
        echo "Checking for image ${{ inputs.image_name }}:${{ inputs.image_tag }}..."
        image_tags=$(gcloud container images list-tags $filter --format=json ${{ inputs.image_name }})
        if [ "$image_tags" = "[]" ]; then
          if [ "${{ inputs.required }}" = "true" ]; then
            exit 1
          fi
          image_tag_exists=false
        else
          image_tag_exists=true
        fi

        echo "image_exists=$image_tag_exists" >> $GITHUB_OUTPUT
```


### Relevant log output

```sh
Trimmed to relevant stuff:

[Testing/test-step-1]   ✅  Success - Main Checkout default commit
[Testing/test-step-1] ⭐ Run Main Get commit tag
[Testing/test-step-1]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/commit-tag] user= workdir=
[Testing/test-step-1]   ✅  Success - Main Get commit tag
[Testing/test-step-1]   ⚙  ::set-output:: build_tag=d35f739
[Testing/test-step-1] ⭐ Run Main Check if image with tag exists
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x9c79e5]

goroutine 54 [running]:
github.com/nektos/act/pkg/runner.getEvaluatorInputs({0xc0002fe0e0?, 0xc91ac8?}, 0xc0002fe0e0, {0x0, 0x0}, 0xc0005cc340)
        C:/src/act/pkg/runner/expression.go:334 +0x265
github.com/nektos/act/pkg/runner.(*RunContext).NewExpressionEvaluator(0xc0002fe0e0, {0xc91ac8, 0xc0001db0b0})
        C:/src/act/pkg/runner/expression.go:44 +0x477
github.com/nektos/act/pkg/runner.setupEnv({0xc91ac8, 0xc0001db0b0}, {0xc94bb0?, 0xc0001da6c0?})
        C:/src/act/pkg/runner/step.go:180 +0x2cf
github.com/nektos/act/pkg/runner.runStepExecutor.func1({0xc91ac8, 0xc0001db0b0})
        C:/src/act/pkg/runner/step.go:74 +0x1d1
github.com/nektos/act/pkg/runner.(*RunContext).newCompositeCommandExecutor.func1({0xc91ac8?, 0xc0001daf30?})
        C:/src/act/pkg/runner/action_composite.go:197 +0x26c
github.com/nektos/act/pkg/runner.(*RunContext).compositeExecutor.func1({0xc91ac8?, 0xc0001dadb0?})
        C:/src/act/pkg/runner/action_composite.go:142 +0xb2
github.com/nektos/act/pkg/common.Executor.Then.func1({0xc91ac8, 0xc0001dadb0})
        C:/src/act/pkg/common/executor.go:129 +0x34
github.com/nektos/act/pkg/runner.(*RunContext).compositeExecutor.func3({0xc91ac8, 0xc0001dad50})
        C:/src/act/pkg/runner/action_composite.go:170 +0x70
github.com/nektos/act/pkg/runner.execAsComposite.func1({0xc91ac8, 0xc0003ec900})
        C:/src/act/pkg/runner/action_composite.go:88 +0xd4
github.com/nektos/act/pkg/runner.runActionImpl.func1({0xc91ac8, 0xc0003ec900})
        C:/src/act/pkg/runner/action.go:169 +0x82f
github.com/nektos/act/pkg/runner.(*stepActionLocal).main.func1({0xc91ac8, 0xc0003ec900})
        C:/src/act/pkg/runner/step_action_local.go:64 +0x1b7
github.com/nektos/act/pkg/runner.runStepExecutor.func1({0xc91ac8, 0xc0003ec900})
        C:/src/act/pkg/runner/step.go:113 +0x78b
github.com/nektos/act/pkg/runner.newJobExecutor.func3({0xc91ac8, 0xc0003ec900})
        C:/src/act/pkg/runner/job_executor.go:63 +0x5a
github.com/nektos/act/pkg/runner.useStepLogger.func1({0xc91ac8?, 0xc0001dae70?})
        C:/src/act/pkg/runner/job_executor.go:137 +0x32b
github.com/nektos/act/pkg/common.Executor.Then.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/common/executor.go:141 +0x15b
github.com/nektos/act/pkg/common.Executor.Finally.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/common/executor.go:175 +0x34
github.com/nektos/act/pkg/common.Executor.Finally.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/common/executor.go:175 +0x34
github.com/nektos/act/pkg/common.Executor.Finally.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/common/executor.go:175 +0x34
github.com/nektos/act/pkg/common.Executor.Then.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/common/executor.go:141 +0x15b
github.com/nektos/act/pkg/runner.(*RunContext).Executor.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/runner/run_context.go:281 +0x7e
github.com/nektos/act/pkg/common.Executor.Finally.func1({0xc91ac8, 0xc0001dae70})
        C:/src/act/pkg/common/executor.go:175 +0x34
github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1.1({0xc91ac8, 0xc0004a4510})
        C:/src/act/pkg/runner/runner.go:197 +0x377
github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0x0?, 0x0?)
        C:/src/act/pkg/common/executor.go:100 +0x5c
created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1
        C:/src/act/pkg/common/executor.go:98 +0x89
```


### Additional information

*Stack trace at time of failure:*
```
github.com/nektos/act/pkg/model.(*Workflow).WorkflowDispatchConfig (c:\src\act\pkg\model\workflow.go:84)
github.com/nektos/act/pkg/runner.getEvaluatorInputs (c:\src\act\pkg\runner\expression.go:333)
github.com/nektos/act/pkg/runner.(*RunContext).NewExpressionEvaluator (c:\src\act\pkg\runner\expression.go:44)
github.com/nektos/act/pkg/runner.setupEnv (c:\src\act\pkg\runner\step.go:180)
github.com/nektos/act/pkg/runner.runStepExecutor.func1 (c:\src\act\pkg\runner\step.go:74)
github.com/nektos/act/pkg/runner.(*RunContext).newCompositeCommandExecutor.func1 (c:\src\act\pkg\runner\action_composite.go:197)
github.com/nektos/act/pkg/runner.(*RunContext).compositeExecutor.func1 (c:\src\act\pkg\runner\action_composite.go:142)
github.com/nektos/act/pkg/common.Executor.Then.func1 (c:\src\act\pkg\common\executor.go:129)
github.com/nektos/act/pkg/runner.(*RunContext).compositeExecutor.func3 (c:\src\act\pkg\runner\action_composite.go:170)
github.com/nektos/act/pkg/runner.execAsComposite.func1 (c:\src\act\pkg\runner\action_composite.go:88)
github.com/nektos/act/pkg/runner.runActionImpl.func1 (c:\src\act\pkg\runner\action.go:169)
github.com/nektos/act/pkg/runner.(*stepActionLocal).main.func1 (c:\src\act\pkg\runner\step_action_local.go:64)
github.com/nektos/act/pkg/runner.runStepExecutor.func1 (c:\src\act\pkg\runner\step.go:113)
github.com/nektos/act/pkg/runner.newJobExecutor.func3 (c:\src\act\pkg\runner\job_executor.go:63)
github.com/nektos/act/pkg/runner.useStepLogger.func1 (c:\src\act\pkg\runner\job_executor.go:137)
github.com/nektos/act/pkg/common.Executor.Then.func1 (c:\src\act\pkg\common\executor.go:141)
github.com/nektos/act/pkg/common.Executor.Finally.func1 (c:\src\act\pkg\common\executor.go:175)
github.com/nektos/act/pkg/common.Executor.Finally.func1 (c:\src\act\pkg\common\executor.go:175)
github.com/nektos/act/pkg/common.Executor.Finally.func1 (c:\src\act\pkg\common\executor.go:175)
github.com/nektos/act/pkg/common.Executor.Then.func1 (c:\src\act\pkg\common\executor.go:141)
```



Discussion / hints:

Fix patch:
diff --git a/pkg/runner/expression.go b/pkg/runner/expression.go
index adba56996cf..4369980086f 100644
--- a/pkg/runner/expression.go
+++ b/pkg/runner/expression.go
@@ -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
+				}
 			}
 		}
 	}


Test patch:
diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go
index dbf8a007dc3..232fc163195 100644
--- a/pkg/runner/runner_test.go
+++ b/pkg/runner/runner_test.go
@@ -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},
diff --git a/pkg/runner/testdata/workflow_dispatch-scalar-composite-action/workflow_dispatch.yml b/pkg/runner/testdata/workflow_dispatch-scalar-composite-action/workflow_dispatch.yml
new file mode 100644
index 00000000000..f8447b45ba3
--- /dev/null
+++ b/pkg/runner/testdata/workflow_dispatch-scalar-composite-action/workflow_dispatch.yml
@@ -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: ./
diff --git a/pkg/runner/testdata/workflow_dispatch-scalar/workflow_dispatch.yml b/pkg/runner/testdata/workflow_dispatch-scalar/workflow_dispatch.yml
new file mode 100644
index 00000000000..9c900e877cc
--- /dev/null
+++ b/pkg/runner/testdata/workflow_dispatch-scalar/workflow_dispatch.yml
@@ -0,0 +1,9 @@
+name: workflow_dispatch
+
+on: workflow_dispatch
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - run: exit 0
diff --git a/pkg/runner/testdata/workflow_dispatch_no_inputs_mapping/workflow_dispatch.yml b/pkg/runner/testdata/workflow_dispatch_no_inputs_mapping/workflow_dispatch.yml
new file mode 100644
index 00000000000..9fc6b09724f
--- /dev/null
+++ b/pkg/runner/testdata/workflow_dispatch_no_inputs_mapping/workflow_dispatch.yml
@@ -0,0 +1,10 @@
+name: workflow_dispatch
+
+on:
+  workflow_dispatch:
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - run: exit 0