[GH-ISSUE #1195] Unable to use a github environment variables on "env" #666

Closed
opened 2026-03-01 21:45:22 +03:00 by kerem · 0 comments
Owner

Originally created by @aanm on GitHub (Jun 2, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1195

Bug report info

$ act --bug-report
act version:            0.2.26
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 20
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/aanm/.actrc:
                -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
                -P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04
Docker Engine:
        Engine version:        20.10.16
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        btrfs
        Registry URI:          https://index.docker.io/v1/
        OS:                    Fedora Linux 36 (KDE Plasma)
        OS type:               linux
        OS version:            36
        OS arch:               x86_64
        OS kernel:             5.17.11-300.fc36.x86_64
        OS CPU:                20
        OS memory:             63977 MB
        Security options:
                name=seccomp,profile=default
                name=cgroupns

Command used with act

act -W test-act.yaml -v

Describe issue

It looks it's not possible to use a ${{ github.repository_owner }} in the environment variables as it results on a "bad substitution" error

No response

Workflow content

name: ACT Test

on:
  push:  {}

env:
  variable: "${{ github.repository_owner }}"

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: print env.variable
        run: |
          echo ${{ env.variable }}

Relevant log output

DEBU[0000] Loading environment from /github.com/nektos/act/.github/workflows/.env 
DEBU[0000] Loading secrets from /github.com/nektos/act/.github/workflows/.secrets 
DEBU[0000] Loading workflow '/github.com/nektos/act/.github/workflows/test-act.yaml' 
DEBU[0000] Reading workflow '/github.com/nektos/act/.github/workflows/test-act.yaml' 
DEBU[0000] Planning event: push                         
DEBU[0000] Loading slug from git directory '/github.com/nektos/act/.git' 
DEBU[0000] Loading revision from git directory '/github.com/nektos/act/.git' 
DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0000] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' 
DEBU[0000] using github ref: refs/heads/master          
DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0000] evaluating expression 'success()'            
DEBU[0000] expression 'success()' evaluated to 'true'   
[ACT Test/test] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
DEBU[0000] Loading slug from git directory '/github.com/nektos/act/.git' 
DEBU[0000] Loading revision from git directory '/github.com/nektos/act/.git' 
DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0000] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' 
DEBU[0000] using github ref: refs/heads/master          
DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
[ACT Test/test]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[ACT Test/test]   🐳  docker pull ghcr.io/catthehacker/ubuntu:act-latest
DEBU[0000] Image exists? true                           
[ACT Test/test] Removed container: 66546c1e58f693cef2f7f82762bd40dac2650d6b69f8fffcb3d96ec222ca6476
[ACT Test/test]   🐳  docker volume rm act-ACT-Test-test
[ACT Test/test]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[ACT Test/test] Created container name=act-ACT-Test-test id=72788cc8439727ab7dd39169a72c3a1ec5600cedad46b1f22ec6e8300526edeb from image ghcr.io/catthehacker/ubuntu:act-latest (platform: )
[ACT Test/test] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_TEMP=/tmp]
[ACT Test/test]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[ACT Test/test] Starting container: 72788cc8439727ab7dd39169a72c3a1ec5600cedad46b1f22ec6e8300526edeb
[ACT Test/test] Started container: 72788cc8439727ab7dd39169a72c3a1ec5600cedad46b1f22ec6e8300526edeb
[ACT Test/test]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[ACT Test/test] Exec command '[mkdir -m 0777 -p /var/run/act]'
[ACT Test/test] Working directory '/github.com/nektos/act/.github/workflows'
DEBU[0001] Writing entry to tarball workflow/event.json len:2 
DEBU[0001] Writing entry to tarball workflow/envs.txt len:0 
DEBU[0001] Writing entry to tarball workflow/paths.txt len:0 
[ACT Test/test] Extracting content to '/var/run/act/'
DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' 
DEBU[0001] using github ref: refs/heads/master          
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] evaluating expression ''                     
DEBU[0001] expression '' evaluated to 'true'            
DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' 
DEBU[0001] using github ref: refs/heads/master          
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' 
DEBU[0001] using github ref: refs/heads/master          
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] expression '${{ github.repository_owner }}' rewritten to 'format('{0}', github.repository_owner)' 
DEBU[0001] evaluating expression 'format('{0}', github.repository_owner)' 
DEBU[0001] expression 'format('{0}', github.repository_owner)' evaluated to '%!t(string=nektos)' 
[ACT Test/test] setupEnv => map[ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/master GITHUB_REPOSITORY:nektos/act GITHUB_REPOSITORY_OWNER:nektos GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:64387bcf7b92f07b42a4c93f7e4504219af5df2c GITHUB_TOKEN: GITHUB_WORKFLOW:ACT Test GITHUB_WORKSPACE:/github.com/nektos/act/.github/workflows IMAGE_OS:ubuntu20 ImageOS:ubuntu20 LSB_OS_VERSION:2004 LSB_RELEASE:20.04 PATH:/opt/hostedtoolcache/node/16.15.0/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root variable:nektos]
[ACT Test/test] ⭐  Run print env.variable
DEBU[0001] expression 'echo ${{ env.variable }}
' rewritten to 'format('echo {0}
', env.variable)' 
DEBU[0001] evaluating expression 'format('echo {0}
', env.variable)' 
DEBU[0001] expression 'format('echo {0}
', env.variable)' evaluated to '%!t(string=echo ${{ github.repository_owner }}
)' 
DEBU[0001] Wrote command 

echo ${{ github.repository_owner }}


 to 'workflow/0' 
DEBU[0001] Writing entry to tarball workflow/0 len:38   
[ACT Test/test] Extracting content to '/var/run/act'
[ACT Test/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[ACT Test/test] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]'
[ACT Test/test] Working directory '/github.com/nektos/act/.github/workflows'
| /var/run/act/workflow/0: line 2: ${{ github.repository_owner }}: bad substitution
[ACT Test/test]   ❌  Failure - print env.variable
[ACT Test/test] exit with `FAILURE`: 1
DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' 
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' 
DEBU[0001] using github ref: refs/heads/master          
DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c 
Error: Job 'test' failed

Additional information

No response

Originally created by @aanm on GitHub (Jun 2, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1195 ### Bug report info ```plain text $ act --bug-report act version: 0.2.26 GOOS: linux GOARCH: amd64 NumCPU: 20 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: /var/run/docker.sock Config files: /home/aanm/.actrc: -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest -P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04 Docker Engine: Engine version: 20.10.16 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: btrfs Registry URI: https://index.docker.io/v1/ OS: Fedora Linux 36 (KDE Plasma) OS type: linux OS version: 36 OS arch: x86_64 OS kernel: 5.17.11-300.fc36.x86_64 OS CPU: 20 OS memory: 63977 MB Security options: name=seccomp,profile=default name=cgroupns ``` ### Command used with act ```sh act -W test-act.yaml -v ``` ### Describe issue It looks it's not possible to use a `${{ github.repository_owner }}` in the environment variables as it results on a "bad substitution" error ### Link to GitHub repository _No response_ ### Workflow content ```yml name: ACT Test on: push: {} env: variable: "${{ github.repository_owner }}" jobs: test: runs-on: ubuntu-latest steps: - name: print env.variable run: | echo ${{ env.variable }} ``` ### Relevant log output ```sh DEBU[0000] Loading environment from /github.com/nektos/act/.github/workflows/.env DEBU[0000] Loading secrets from /github.com/nektos/act/.github/workflows/.secrets DEBU[0000] Loading workflow '/github.com/nektos/act/.github/workflows/test-act.yaml' DEBU[0000] Reading workflow '/github.com/nektos/act/.github/workflows/test-act.yaml' DEBU[0000] Planning event: push DEBU[0000] Loading slug from git directory '/github.com/nektos/act/.git' DEBU[0000] Loading revision from git directory '/github.com/nektos/act/.git' DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0000] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' DEBU[0000] using github ref: refs/heads/master DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0000] evaluating expression 'success()' DEBU[0000] expression 'success()' evaluated to 'true' [ACT Test/test] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest DEBU[0000] Loading slug from git directory '/github.com/nektos/act/.git' DEBU[0000] Loading revision from git directory '/github.com/nektos/act/.git' DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0000] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' DEBU[0000] using github ref: refs/heads/master DEBU[0000] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c [ACT Test/test] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false [ACT Test/test] 🐳 docker pull ghcr.io/catthehacker/ubuntu:act-latest DEBU[0000] Image exists? true [ACT Test/test] Removed container: 66546c1e58f693cef2f7f82762bd40dac2650d6b69f8fffcb3d96ec222ca6476 [ACT Test/test] 🐳 docker volume rm act-ACT-Test-test [ACT Test/test] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [ACT Test/test] Created container name=act-ACT-Test-test id=72788cc8439727ab7dd39169a72c3a1ec5600cedad46b1f22ec6e8300526edeb from image ghcr.io/catthehacker/ubuntu:act-latest (platform: ) [ACT Test/test] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_TEMP=/tmp] [ACT Test/test] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [ACT Test/test] Starting container: 72788cc8439727ab7dd39169a72c3a1ec5600cedad46b1f22ec6e8300526edeb [ACT Test/test] Started container: 72788cc8439727ab7dd39169a72c3a1ec5600cedad46b1f22ec6e8300526edeb [ACT Test/test] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [ACT Test/test] Exec command '[mkdir -m 0777 -p /var/run/act]' [ACT Test/test] Working directory '/github.com/nektos/act/.github/workflows' DEBU[0001] Writing entry to tarball workflow/event.json len:2 DEBU[0001] Writing entry to tarball workflow/envs.txt len:0 DEBU[0001] Writing entry to tarball workflow/paths.txt len:0 [ACT Test/test] Extracting content to '/var/run/act/' DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' DEBU[0001] using github ref: refs/heads/master DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] evaluating expression '' DEBU[0001] expression '' evaluated to 'true' DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' DEBU[0001] using github ref: refs/heads/master DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' DEBU[0001] using github ref: refs/heads/master DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] expression '${{ github.repository_owner }}' rewritten to 'format('{0}', github.repository_owner)' DEBU[0001] evaluating expression 'format('{0}', github.repository_owner)' DEBU[0001] expression 'format('{0}', github.repository_owner)' evaluated to '%!t(string=nektos)' [ACT Test/test] setupEnv => map[ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/master GITHUB_REPOSITORY:nektos/act GITHUB_REPOSITORY_OWNER:nektos GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:64387bcf7b92f07b42a4c93f7e4504219af5df2c GITHUB_TOKEN: GITHUB_WORKFLOW:ACT Test GITHUB_WORKSPACE:/github.com/nektos/act/.github/workflows IMAGE_OS:ubuntu20 ImageOS:ubuntu20 LSB_OS_VERSION:2004 LSB_RELEASE:20.04 PATH:/opt/hostedtoolcache/node/16.15.0/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root variable:nektos] [ACT Test/test] ⭐ Run print env.variable DEBU[0001] expression 'echo ${{ env.variable }} ' rewritten to 'format('echo {0} ', env.variable)' DEBU[0001] evaluating expression 'format('echo {0} ', env.variable)' DEBU[0001] expression 'format('echo {0} ', env.variable)' evaluated to '%!t(string=echo ${{ github.repository_owner }} )' DEBU[0001] Wrote command echo ${{ github.repository_owner }} to 'workflow/0' DEBU[0001] Writing entry to tarball workflow/0 len:38 [ACT Test/test] Extracting content to '/var/run/act' [ACT Test/test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir= [ACT Test/test] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]' [ACT Test/test] Working directory '/github.com/nektos/act/.github/workflows' | /var/run/act/workflow/0: line 2: ${{ github.repository_owner }}: bad substitution [ACT Test/test] ❌ Failure - print env.variable [ACT Test/test] exit with `FAILURE`: 1 DEBU[0001] Loading slug from git directory '/github.com/nektos/act/.git' DEBU[0001] Loading revision from git directory '/github.com/nektos/act/.git' DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c DEBU[0001] HEAD points to '64387bcf7b92f07b42a4c93f7e4504219af5df2c' DEBU[0001] using github ref: refs/heads/master DEBU[0001] Found revision: 64387bcf7b92f07b42a4c93f7e4504219af5df2c Error: Job 'test' failed ``` ### Additional information _No response_
kerem 2026-03-01 21:45:22 +03:00
  • closed this issue
  • added the
    kind/bug
    label
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#666
No description provided.