[GH-ISSUE #2751] shell temporary file is outside ${{ runner.temp }} #1243

Open
opened 2026-03-01 21:49:54 +03:00 by kerem · 0 comments
Owner

Originally created by @siferati on GitHub (May 13, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2751

Bug report info

act version:            0.2.76
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/siferati/.config/act/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.24.1
	Module path:           github.com/nektos/act
	Main version:          v0.2.76
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.76 -X main.commit=4f4913f9f34da9f349bf4f842c56e9d7f8af3729 -X main.date=2025-04-01T02:36:03Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         4f4913f9f34da9f349bf4f842c56e9d7f8af3729
		vcs.time:             2025-04-01T02:35:41Z
		vcs.modified:         false
Docker Engine:
	Engine version:        28.0.4
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Ubuntu 22.04.5 LTS
	OS type:               linux
	OS version:            22.04
	OS arch:               x86_64
	OS kernel:             6.8.0-57-generic
	OS CPU:                16
	OS memory:             31853 MB
	Security options:
		name=apparmor
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act --workflows ".github/workflows/debug.yml"

Describe issue

When setting jobs.<job_id>.steps[*].shell, the commands to execute are stored in a temporary file.

The shell command that is run internally executes a temporary file that contains the commands specified in the run keyword.

On github, this temporary file is located inside ${{ runner.temp }}
This is not the case for act.

With act, ${{ runner.temp }} points to /tmp, but the temporary file is located inside /var/run/act/workflow
This causes workflows that rely on this behaviour to fail when run via act (see minimal example below).

It's possible to work around the issue by mounting /tmp/act/workflow:/var/run/act/workflow in both foo and act containers:

  • Add --volume=/tmp/act/workflow:/var/run/act/workflow to docker run command inside the workflow
  • Add --volume=/tmp/act/workflow:/var/run/act/workflow to the --container-options flag of act

But I shouldn't be required to modify the contents of my workflow to make it compatible with act.
The underlying problem is that act stores the shell temporary file in a location that's different from the github runners.

TL;DR: The shell temporary file should be stored in ${{ runner.temp }}, not inside /var/run/act/workflow.

Workflow content

name: Debug

on: push

jobs:
  debug:
    runs-on: ubuntu-22.04
    steps:
      # this works fine
      - shell: bash -e {0}
        run: echo "Hello world"

      - name: start container
        run: >-
          docker run
          --name foo
          --detach
          --tty
          --mount type=bind,source=${{ runner.temp }},target=${{ runner.temp }}
          ubuntu:22.04
      
      # this fails
      - shell: docker exec foo bash -e {0}
        run: echo "Hello world"

Relevant log output

INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' 
[Debug/debug] ⭐ Run Set up job
[Debug/debug] 🚀  Start image=catthehacker/ubuntu:act-22.04
[Debug/debug]   🐳  docker pull image=catthehacker/ubuntu:act-22.04 platform= username= forcePull=true
[Debug/debug]   🐳  docker create image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Debug/debug]   🐳  docker run image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Debug/debug]   🐳  docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir=
[Debug/debug]   ✅  Success - Set up job
[Debug/debug] ⭐ Run Main echo "Hello world"
[Debug/debug]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/0] user= workdir=
| Hello world
[Debug/debug]   ✅  Success - Main echo "Hello world" [111.707601ms]
[Debug/debug] ⭐ Run Main start container
[Debug/debug]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir=
| a9dd3f5cdd58beb38423dcd8492def0f83d51bac8ddfbd9e2e53fa1342fc36cd
[Debug/debug]   ✅  Success - Main start container [240.312769ms]
[Debug/debug] ⭐ Run Main echo "Hello world"
[Debug/debug]   🐳  docker exec cmd=[docker exec foo bash -e /var/run/act/workflow/2] user= workdir=
| bash: /var/run/act/workflow/2: No such file or directory
[Debug/debug]   ❌  Failure - Main echo "Hello world" [173.559343ms]
[Debug/debug] exitcode '1': failure
[Debug/debug] ⭐ Run Complete job
[Debug/debug]   ✅  Success - Complete job
[Debug/debug] 🏁  Job failed
Error: Job 'debug' failed
Originally created by @siferati on GitHub (May 13, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2751 ### Bug report info ```plain text act version: 0.2.76 GOOS: linux GOARCH: amd64 NumCPU: 16 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/siferati/.config/act/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.24.1 Module path: github.com/nektos/act Main version: v0.2.76 Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -s -w -X main.version=0.2.76 -X main.commit=4f4913f9f34da9f349bf4f842c56e9d7f8af3729 -X main.date=2025-04-01T02:36:03Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: 4f4913f9f34da9f349bf4f842c56e9d7f8af3729 vcs.time: 2025-04-01T02:35:41Z vcs.modified: false Docker Engine: Engine version: 28.0.4 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Ubuntu 22.04.5 LTS OS type: linux OS version: 22.04 OS arch: x86_64 OS kernel: 6.8.0-57-generic OS CPU: 16 OS memory: 31853 MB Security options: name=apparmor name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act --workflows ".github/workflows/debug.yml" ``` ### Describe issue When setting [jobs.<job_id>.steps[*].shell](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell), the commands to execute are stored in a temporary file. > _The shell command that is run internally executes a temporary file that contains the commands specified in the run keyword._ On github, this temporary file is located inside `${{ runner.temp }}` This is not the case for act. With act, `${{ runner.temp }}` points to `/tmp`, but the temporary file is located inside `/var/run/act/workflow` This causes workflows that rely on this behaviour to fail when run via act (see minimal example below). It's possible to work around the issue by mounting `/tmp/act/workflow:/var/run/act/workflow` in both `foo` **and** `act` containers: - Add `--volume=/tmp/act/workflow:/var/run/act/workflow` to `docker run` command inside the workflow - Add `--volume=/tmp/act/workflow:/var/run/act/workflow` to the `--container-options` flag of act But I shouldn't be required to modify the contents of my workflow to make it compatible with act. The underlying problem is that act stores the shell temporary file in a location that's different from the github runners. **TL;DR:** The shell temporary file should be stored in `${{ runner.temp }}`, not inside `/var/run/act/workflow`. ### Workflow content ```yml name: Debug on: push jobs: debug: runs-on: ubuntu-22.04 steps: # this works fine - shell: bash -e {0} run: echo "Hello world" - name: start container run: >- docker run --name foo --detach --tty --mount type=bind,source=${{ runner.temp }},target=${{ runner.temp }} ubuntu:22.04 # this fails - shell: docker exec foo bash -e {0} run: echo "Hello world" ``` ### Relevant log output ```sh INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' [Debug/debug] ⭐ Run Set up job [Debug/debug] 🚀 Start image=catthehacker/ubuntu:act-22.04 [Debug/debug] 🐳 docker pull image=catthehacker/ubuntu:act-22.04 platform= username= forcePull=true [Debug/debug] 🐳 docker create image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host" [Debug/debug] 🐳 docker run image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host" [Debug/debug] 🐳 docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir= [Debug/debug] ✅ Success - Set up job [Debug/debug] ⭐ Run Main echo "Hello world" [Debug/debug] 🐳 docker exec cmd=[bash -e /var/run/act/workflow/0] user= workdir= | Hello world [Debug/debug] ✅ Success - Main echo "Hello world" [111.707601ms] [Debug/debug] ⭐ Run Main start container [Debug/debug] 🐳 docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir= | a9dd3f5cdd58beb38423dcd8492def0f83d51bac8ddfbd9e2e53fa1342fc36cd [Debug/debug] ✅ Success - Main start container [240.312769ms] [Debug/debug] ⭐ Run Main echo "Hello world" [Debug/debug] 🐳 docker exec cmd=[docker exec foo bash -e /var/run/act/workflow/2] user= workdir= | bash: /var/run/act/workflow/2: No such file or directory [Debug/debug] ❌ Failure - Main echo "Hello world" [173.559343ms] [Debug/debug] exitcode '1': failure [Debug/debug] ⭐ Run Complete job [Debug/debug] ✅ Success - Complete job [Debug/debug] 🏁 Job failed Error: Job 'debug' failed ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1243
No description provided.