Repository: nektos/act (language: go)

Issue:
Getting "Caching for 'false' is not supported" error when using 3rd party action
### Bug report info

```plain text
act version:            0.2.60
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/vinci/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:full-latest
                -P ubuntu-22.04=catthehacker/ubuntu:full-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:full-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:full-18.04
Build info:
        Go version:            go1.22.0
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -buildmode:           pie
                -compiler:            gc
                -trimpath:            true
                DefaultGODEBUG:       httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
                CGO_ENABLED:          1
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
Docker Engine:
        Engine version:        25.0.3
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Garuda Linux
        OS type:               linux
        OS version:            
        OS arch:               x86_64
        OS kernel:             6.7.8-zen1-1-zen
        OS CPU:                16
        OS memory:             31241 MB
        Security options:
                name=seccomp,profile=builtin
                name=cgroupns
```


### Command used with act

```sh
act
```


### Describe issue

I have a workflow which uses the [install-qt-action](https://github.com/jurplel/install-qt-action) action which I'd like to run locally. Sadly this GitHub action seems to setup some Python stuff which act complains about.

### Link to GitHub repository

_No response_

### Workflow content

```yml
name: build

on:
  push:
    branches: [master]

jobs:
  x86_64-linux-gnu-gcc:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4.1.1
        with:
          fetch-depth: 0
      - uses: jurplel/install-qt-action@v3
        with:
          version: '6.6.2'
      - run: cmake -Bbuild
        env:
          CC:   gcc-13
          CXX:  g++-13
      - run: cmake --build build --parallel --target all
```


### Relevant log output

```sh
[build/x86_64-linux-gnu-gcc] ⭐ Run Main jurplel/install-qt-action@v3
[build/x86_64-linux-gnu-gcc]   🐳  docker cp src=/home/vinci/.cache/act/jurplel-install-qt-action@v3/ dst=/var/run/act/actions/jurplel-install-qt-action@v3/
[build/x86_64-linux-gnu-gcc]   🐳  docker exec cmd=[chown -R 1001:127 /var/run/act/actions/jurplel-install-qt-action@v3/] user=0 workdir=
[build/x86_64-linux-gnu-gcc] ⭐ Run Main Setup Python
[build/x86_64-linux-gnu-gcc]   🐳  docker cp src=/home/vinci/.cache/act/actions-setup-python@v5/ dst=/var/run/act/actions/actions-setup-python@v5/
[build/x86_64-linux-gnu-gcc]   🐳  docker exec cmd=[chown -R 1001:127 /var/run/act/actions/actions-setup-python@v5/] user=0 workdir=
[build/x86_64-linux-gnu-gcc]   🐳  docker exec cmd=[node /var/run/act/actions/actions-setup-python@v5/dist/setup/index.js] user= workdir=
[build/x86_64-linux-gnu-gcc]   💬  ::debug::Python is expected to be installed into /opt/hostedtoolcache
[build/x86_64-linux-gnu-gcc]   ❓  ::group::Installed versions
[build/x86_64-linux-gnu-gcc]   💬  ::debug::Semantic version spec of 3.6.x - 3.11.x is 3.6.x - 3.11.x
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? false
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 3.10.13
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? true
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 3.11.7
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? true
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 3.12.1
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? true
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 3.7.17
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? true
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 3.8.18
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? true
[build/x86_64-linux-gnu-gcc]   💬  ::debug::isExplicit: 3.9.18
[build/x86_64-linux-gnu-gcc]   💬  ::debug::explicit? true
[build/x86_64-linux-gnu-gcc]   💬  ::debug::evaluating 6 versions
[build/x86_64-linux-gnu-gcc]   💬  ::debug::matched: 3.11.7
[build/x86_64-linux-gnu-gcc]   💬  ::debug::checking cache: /opt/hostedtoolcache/Python/3.11.7/x64
[build/x86_64-linux-gnu-gcc]   💬  ::debug::Found tool in cache Python 3.11.7 x64
| Successfully set up CPython (3.11.7)
[build/x86_64-linux-gnu-gcc]   ❓  ::endgroup::
[build/x86_64-linux-gnu-gcc]   ❗  ::error::Caching for 'false' is not supported
[build/x86_64-linux-gnu-gcc]   ❌  Failure - Main Setup Python
```


### Additional information
I don't have a lot of experience with GitHub actions yet, please forgive me if this isn't a really a bug. Might it be due to act not supporting caching?


Discussion / hints:
Same issue here
```bash
[Build Stacer Application/Build App]   💬  ::debug::Found tool in cache Python 3.11.9 x64
| Successfully set up CPython (3.11.9)
[Build Stacer Application/Build App]   ❓  ::endgroup::
[Build Stacer Application/Build App]   ❗  ::error::Caching for 'false' is not supported
[Build Stacer Application/Build App]   ❌  Failure - Main Setup Python
[Build Stacer Application/Build App]   ⚙  ::set-env:: pythonLocation=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: PKG_CONFIG_PATH=/opt/hostedtoolcache/Python/3.11.9/x64/lib/pkgconfig
[Build Stacer Application/Build App]   ⚙  ::set-env:: Python_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: Python2_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: Python3_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: LD_LIBRARY_PATH=/opt/hostedtoolcache/Python/3.11.9/x64/lib
[Build Stacer Application/Build App]   ⚙  ::set-output:: python-version=3.11.9
[Build Stacer Application/Build App]   ⚙  ::set-output:: python-path=/opt/hostedtoolcache/Python/3.11.9/x64/bin/python
[Build Stacer Application/Build App]   ⚙  ::add-path:: /opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::add-path:: /opt/hostedtoolcache/Python/3.11.9/x64/bin
[Build Stacer Application/Build App] exitcode '1': failure
[Build Stacer Application/Build App]   ❌  Failure - Main Install Qt
[Build Stacer Application/Build App]   ⚙  ::set-env:: pythonLocation=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: PKG_CONFIG_PATH=/opt/hostedtoolcache/Python/3.11.9/x64/lib/pkgconfig
[Build Stacer Application/Build App]   ⚙  ::set-env:: Python_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: Python2_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: Python3_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::set-env:: LD_LIBRARY_PATH=/opt/hostedtoolcache/Python/3.11.9/x64/lib
[Build Stacer Application/Build App]   ⚙  ::set-output:: python-version=3.11.9
[Build Stacer Application/Build App]   ⚙  ::set-output:: python-path=/opt/hostedtoolcache/Python/3.11.9/x64/bin/python
[Build Stacer Application/Build App]   ⚙  ::add-path:: /opt/hostedtoolcache/Python/3.11.9/x64
[Build Stacer Application/Build App]   ⚙  ::add-path:: /opt/hostedtoolcache/Python/3.11.9/x64/bin
[Build Stacer Application/Build App] exitcode '1': failure```
It is failing, whatever value you set for 'cache' when using jurplel/install-qt-action@v3
The error is:
❗  ::error::Caching for 'false'/'true' is not supported

So, I do not see the way to use this action with act

This is the interesting code:
```
      - name: Install Qt Android
        uses: jurplel/install-qt-action@v3
        with:
          version: '5.15.0'
          host: 'linux'
          target: 'android'
          arch: 'android'
          modules: 'qtcharts  qtnetworkauth'
          dir: '${{ github.workspace }}/output/android/'
          # cache: 'true'
          # cache-key-prefix: 'install-qt-action-android'                    
```
Uncomment last two lines to test with 'true'

Fix patch:
diff --git a/pkg/runner/action.go b/pkg/runner/action.go
index 9b14f1a4c4d..3809359405b 100644
--- a/pkg/runner/action.go
+++ b/pkg/runner/action.go
@@ -625,6 +625,7 @@ func runPostStep(step actionStep) common.Executor {
 		case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16, model.ActionRunsUsingNode20:
 
 			populateEnvsFromSavedState(step.getEnv(), step, rc)
+			populateEnvsFromInput(ctx, step.getEnv(), step.getActionModel(), rc)
 
 			containerArgs := []string{"node", path.Join(containerActionDir, action.Runs.Post)}
 			logger.Debugf("executing remote job container: %s", containerArgs)
diff --git a/pkg/runner/step.go b/pkg/runner/step.go
index c67b5b049d5..e1bcf9ecfdc 100644
--- a/pkg/runner/step.go
+++ b/pkg/runner/step.go
@@ -239,6 +239,16 @@ func mergeEnv(ctx context.Context, step step) {
 	}
 
 	rc.withGithubEnv(ctx, step.getGithubContext(ctx), *env)
+
+	if step.getStepModel().Uses != "" {
+		// prevent uses action input pollution of unset parameters, skip this for run steps
+		// due to design flaw
+		for key := range *env {
+			if strings.Contains(key, "INPUT_") {
+				delete(*env, key)
+			}
+		}
+	}
 }
 
 func isStepEnabled(ctx context.Context, expr string, step step, stage stepStage) (bool, error) {


Test patch:
diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go
index 4dc01e15d0e..dcd03db9813 100644
--- a/pkg/runner/runner_test.go
+++ b/pkg/runner/runner_test.go
@@ -242,6 +242,8 @@ func TestRunEvent(t *testing.T) {
 		// Uses
 		{workdir, "uses-composite", "push", "", platforms, secrets},
 		{workdir, "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms, secrets},
+		{workdir, "uses-composite-check-for-input-collision", "push", "", platforms, secrets},
+		{workdir, "uses-composite-check-for-input-shadowing", "push", "", platforms, secrets},
 		{workdir, "uses-nested-composite", "push", "", platforms, secrets},
 		{workdir, "remote-action-composite-js-pre-with-defaults", "push", "", platforms, secrets},
 		{workdir, "remote-action-composite-action-ref", "push", "", platforms, secrets},
diff --git a/pkg/runner/step_test.go b/pkg/runner/step_test.go
index 5af5acf5ff7..6752d72702f 100644
--- a/pkg/runner/step_test.go
+++ b/pkg/runner/step_test.go
@@ -139,6 +139,7 @@ func TestSetupEnv(t *testing.T) {
 		JobContainer: cm,
 	}
 	step := &model.Step{
+		Uses: "./",
 		With: map[string]string{
 			"STEP_WITH": "with-value",
 		},
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/action.yml b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/action.yml
new file mode 100644
index 00000000000..1e9a8122f64
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/action.yml
@@ -0,0 +1,16 @@
+name: "Action with pre and post"
+description: "Action with pre and post"
+
+inputs:
+  step:
+    description: "step"
+    required: true
+  cache:
+    required: false
+    default: false
+
+runs:
+  using: "node16"
+  pre: pre.js
+  main: main.js
+  post: post.js
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/main.js b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/main.js
new file mode 100644
index 00000000000..5a58515a725
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/main.js
@@ -0,0 +1,14 @@
+const { appendFileSync } = require('fs');
+const step = process.env['INPUT_STEP'];
+appendFileSync(process.env['GITHUB_ENV'], `TEST=${step}`, { encoding:'utf-8' })
+
+var cache = process.env['INPUT_CACHE']
+try {
+    var cache = JSON.parse(cache)
+} catch {
+
+}
+if(typeof cache !== 'boolean') {
+    console.log("Input Polluted boolean true/false expected, got " + cache)
+    process.exit(1);
+}
\ No newline at end of file
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/post.js b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/post.js
new file mode 100644
index 00000000000..2f06cfe8ac7
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/post.js
@@ -0,0 +1,14 @@
+const { appendFileSync } = require('fs');
+const step = process.env['INPUT_STEP'];
+appendFileSync(process.env['GITHUB_ENV'], `TEST=${step}-post`, { encoding:'utf-8' })
+
+var cache = process.env['INPUT_CACHE']
+try {
+    var cache = JSON.parse(cache)
+} catch {
+
+}
+if(typeof cache !== 'boolean') {
+    console.log("Input Polluted boolean true/false expected, got " + cache)
+    process.exit(1);
+}
\ No newline at end of file
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/pre.js b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/pre.js
new file mode 100644
index 00000000000..5d5451401bf
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-collision/action-with-pre-and-post/pre.js
@@ -0,0 +1,12 @@
+console.log('pre');
+
+var cache = process.env['INPUT_CACHE']
+try {
+    var cache = JSON.parse(cache)
+} catch {
+
+}
+if(typeof cache !== 'boolean') {
+    console.log("Input Polluted boolean true/false expected, got " + cache)
+    process.exit(1);
+}
\ No newline at end of file
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-collision/composite_action/action.yml b/pkg/runner/testdata/uses-composite-check-for-input-collision/composite_action/action.yml
new file mode 100644
index 00000000000..d9683b77c5a
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-collision/composite_action/action.yml
@@ -0,0 +1,16 @@
+name: "Test Composite Action"
+description: "Test action uses composite"
+
+inputs:
+  cache:
+    default: none
+
+runs:
+  using: "composite"
+  steps:
+  - uses: ./uses-composite-check-for-input-collision/action-with-pre-and-post
+    with:
+      step: step1
+  - uses: ./uses-composite-check-for-input-collision/action-with-pre-and-post
+    with:
+      step: step2
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-collision/push.yml b/pkg/runner/testdata/uses-composite-check-for-input-collision/push.yml
new file mode 100644
index 00000000000..58510bb0f68
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-collision/push.yml
@@ -0,0 +1,10 @@
+name: uses-composite-with-pre-and-post-steps
+on: push
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - run: echo -n "STEP_OUTPUT_TEST=empty" >> $GITHUB_ENV
+      - uses: ./uses-composite-check-for-input-collision/composite_action
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/action.yml b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/action.yml
new file mode 100644
index 00000000000..1e9a8122f64
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/action.yml
@@ -0,0 +1,16 @@
+name: "Action with pre and post"
+description: "Action with pre and post"
+
+inputs:
+  step:
+    description: "step"
+    required: true
+  cache:
+    required: false
+    default: false
+
+runs:
+  using: "node16"
+  pre: pre.js
+  main: main.js
+  post: post.js
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/main.js b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/main.js
new file mode 100644
index 00000000000..5a58515a725
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/main.js
@@ -0,0 +1,14 @@
+const { appendFileSync } = require('fs');
+const step = process.env['INPUT_STEP'];
+appendFileSync(process.env['GITHUB_ENV'], `TEST=${step}`, { encoding:'utf-8' })
+
+var cache = process.env['INPUT_CACHE']
+try {
+    var cache = JSON.parse(cache)
+} catch {
+
+}
+if(typeof cache !== 'boolean') {
+    console.log("Input Polluted boolean true/false expected, got " + cache)
+    process.exit(1);
+}
\ No newline at end of file
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/post.js b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/post.js
new file mode 100644
index 00000000000..2f06cfe8ac7
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/post.js
@@ -0,0 +1,14 @@
+const { appendFileSync } = require('fs');
+const step = process.env['INPUT_STEP'];
+appendFileSync(process.env['GITHUB_ENV'], `TEST=${step}-post`, { encoding:'utf-8' })
+
+var cache = process.env['INPUT_CACHE']
+try {
+    var cache = JSON.parse(cache)
+} catch {
+
+}
+if(typeof cache !== 'boolean') {
+    console.log("Input Polluted boolean true/false expected, got " + cache)
+    process.exit(1);
+}
\ No newline at end of file
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/pre.js b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/pre.js
new file mode 100644
index 00000000000..5d5451401bf
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/action-with-pre-and-post/pre.js
@@ -0,0 +1,12 @@
+console.log('pre');
+
+var cache = process.env['INPUT_CACHE']
+try {
+    var cache = JSON.parse(cache)
+} catch {
+
+}
+if(typeof cache !== 'boolean') {
+    console.log("Input Polluted boolean true/false expected, got " + cache)
+    process.exit(1);
+}
\ No newline at end of file
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-shadowing/composite_action/action.yml b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/composite_action/action.yml
new file mode 100644
index 00000000000..2cb5b4e9501
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/composite_action/action.yml
@@ -0,0 +1,18 @@
+name: "Test Composite Action"
+description: "Test action uses composite"
+
+inputs:
+  cache:
+    default: true
+
+runs:
+  using: "composite"
+  steps:
+  - uses: ./uses-composite-check-for-input-shadowing/action-with-pre-and-post
+    with:
+      step: step1
+      cache: ${{ inputs.cache || 'none' }}
+  - uses: ./uses-composite-check-for-input-shadowing/action-with-pre-and-post
+    with:
+      step: step2
+      cache: ${{ inputs.cache || 'none' }}
diff --git a/pkg/runner/testdata/uses-composite-check-for-input-shadowing/push.yml b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/push.yml
new file mode 100644
index 00000000000..3fb6324288c
--- /dev/null
+++ b/pkg/runner/testdata/uses-composite-check-for-input-shadowing/push.yml
@@ -0,0 +1,12 @@
+name: uses-composite-with-pre-and-post-steps
+on: push
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - run: echo -n "STEP_OUTPUT_TEST=empty" >> $GITHUB_ENV
+      - uses: ./uses-composite-check-for-input-shadowing/composite_action
+        # with:
+          # cache: other