[GH-ISSUE #2637] Paths to binaries put in GITHUB_PATH are not correctly set #1197

Closed
opened 2026-03-01 21:49:36 +03:00 by kerem · 2 comments
Owner

Originally created by @gotha on GitHub (Jan 29, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2637

Bug report info

act version:            0.2.71
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 14
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:
        /Users/gotha/Library/Application Support/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.23.4
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -trimpath:            true
                CGO_ENABLED:          1
                GOARCH:               arm64
                GOOS:                 darwin
                GOARM64:              v8.0
Docker Engine:
        Engine version:        27.4.0
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               aarch64
        OS kernel:             6.10.14-linuxkit
        OS CPU:                1
        OS memory:             1974 MB
        Security options:
                name=seccomp,profile=unconfined
                name=cgroupns

Command used with act

act -W .github/workflows/test.yaml

Describe issue

When a step in the workflow installs a binary and puts it into $GITHUB_PATH it is not found by other scripts in the same step or job.

Expected behavior:
When test1.sh is executed and the it puts something in $GITHUB_PATH, the binary should be visible to

  • other scripts in the same step
  • scripts in the following step/s
  • steps in a job that depends on the current

The described behaviour works with Github Actions, but fails with act (you can see the workflow in the attachment).

test1.sh

#!/usr/bin/env bash

version="v1.31.4"
arch
case $(uname -m) in
    i686)               arch="386" ;;
    x86_64)             arch="amd64" ;;
    arm|aarch64|arm64)  arch="arm64" ;;
    *) exit 1 ;;
esac

cache_dir="${RUNNER_TOOL_CACHE}/tmp/${version}/${arch}"
echo "cache_dir: $cache_dir"

kubectl_dir="${cache_dir}/kubectl/bin/"
echo "kubectl_dir: $kubectl_dir"
mkdir -p "${kubectl_dir}"
ls -las "$kubectl_dir"

echo "https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl"
curl -sSLo "${kubectl_dir}/kubectl" "https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl"
chmod +x "${kubectl_dir}/kubectl"

echo 'Adding kubectl directory to PATH...'
echo "${kubectl_dir}" >> "${GITHUB_PATH}"

test2.sh

#!/usr/bin/env bash

echo "which:"
which kubectl
echo "kubectl ver"
kubectl version --client

Here is an example of pipeline that succeeds with running the scripts:
https://github.com/gotha/kind-action/actions/runs/13030156289/job/36347477256

The behavior was originally observed when using helm/kind-action@v1

Workflow content

name: Manually trigger a pipeline to test how GITUB_PATH works

on:
  pull_request:
  push:
    branches:
      - *
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: dbg1
      run: |
        ./test1.sh
        ./test2.sh
    - name: dbg2
      run: |
        ./test2.sh

  test:
    runs-on: ubuntu-latest
    needs: build
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: dbg3
      run: |
        ./test2.sh

Relevant log output

[CI/build]   ✅  Success - Main Checkout code
[CI/build] ⭐ Run Main dbg1
[CI/build]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir=
| aarch64
| cache_dir: /opt/hostedtoolcache/tmp/v1.31.4/arm64
| kubectl_dir: /opt/hostedtoolcache/tmp/v1.31.4/arm64/kubectl/bin/
| https://dl.k8s.io/release/v1.31.4/bin/linux/arm64/kubectl
| Adding kubectl directory to PATH...
| which:
| kubectl ver
| .test2.sh: line 6: kubectl: command not found
[CI/build]   ❌  Failure - Main dbg1
[CI/build]   ⚙  ::add-path:: /opt/hostedtoolcache/tmp/v1.31.4/arm64/kubectl/bin/
[CI/build] exitcode '127': command not found, please refer to https://github.com/nektos/act/issues/107 for more information

Additional information

No response

Originally created by @gotha on GitHub (Jan 29, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2637 ### Bug report info ```plain text act version: 0.2.71 GOOS: darwin GOARCH: arm64 NumCPU: 14 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/gotha/Library/Application Support/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.23.4 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -trimpath: true CGO_ENABLED: 1 GOARCH: arm64 GOOS: darwin GOARM64: v8.0 Docker Engine: Engine version: 27.4.0 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: aarch64 OS kernel: 6.10.14-linuxkit OS CPU: 1 OS memory: 1974 MB Security options: name=seccomp,profile=unconfined name=cgroupns ``` ### Command used with act ```sh act -W .github/workflows/test.yaml ``` ### Describe issue When a step in the workflow installs a binary and puts it into `$GITHUB_PATH` it is not found by other scripts in the same step or job. Expected behavior: When `test1.sh` is executed and the it puts something in `$GITHUB_PATH`, the binary should be visible to - other scripts in the same step - scripts in the following step/s - steps in a job that depends on the current The described behaviour works with Github Actions, but fails with `act` (you can see the workflow in the attachment). test1.sh ```sh #!/usr/bin/env bash version="v1.31.4" arch case $(uname -m) in i686) arch="386" ;; x86_64) arch="amd64" ;; arm|aarch64|arm64) arch="arm64" ;; *) exit 1 ;; esac cache_dir="${RUNNER_TOOL_CACHE}/tmp/${version}/${arch}" echo "cache_dir: $cache_dir" kubectl_dir="${cache_dir}/kubectl/bin/" echo "kubectl_dir: $kubectl_dir" mkdir -p "${kubectl_dir}" ls -las "$kubectl_dir" echo "https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl" curl -sSLo "${kubectl_dir}/kubectl" "https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl" chmod +x "${kubectl_dir}/kubectl" echo 'Adding kubectl directory to PATH...' echo "${kubectl_dir}" >> "${GITHUB_PATH}" ``` test2.sh ```sh #!/usr/bin/env bash echo "which:" which kubectl echo "kubectl ver" kubectl version --client ``` ### Link to GitHub repository Here is an example of pipeline that succeeds with running the scripts: https://github.com/gotha/kind-action/actions/runs/13030156289/job/36347477256 The behavior was originally observed when using helm/kind-action@v1 ### Workflow content ```yml name: Manually trigger a pipeline to test how GITUB_PATH works on: pull_request: push: branches: - * workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: dbg1 run: | ./test1.sh ./test2.sh - name: dbg2 run: | ./test2.sh test: runs-on: ubuntu-latest needs: build steps: - name: Checkout code uses: actions/checkout@v4 - name: dbg3 run: | ./test2.sh ``` ### Relevant log output ```sh [CI/build] ✅ Success - Main Checkout code [CI/build] ⭐ Run Main dbg1 [CI/build] 🐳 docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir= | aarch64 | cache_dir: /opt/hostedtoolcache/tmp/v1.31.4/arm64 | kubectl_dir: /opt/hostedtoolcache/tmp/v1.31.4/arm64/kubectl/bin/ | https://dl.k8s.io/release/v1.31.4/bin/linux/arm64/kubectl | Adding kubectl directory to PATH... | which: | kubectl ver | .test2.sh: line 6: kubectl: command not found [CI/build] ❌ Failure - Main dbg1 [CI/build] ⚙ ::add-path:: /opt/hostedtoolcache/tmp/v1.31.4/arm64/kubectl/bin/ [CI/build] exitcode '127': command not found, please refer to https://github.com/nektos/act/issues/107 for more information ``` ### Additional information _No response_
kerem 2026-03-01 21:49:36 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@ChristopherHX commented on GitHub (Jan 30, 2025):

  • other scripts in the same step
  • steps in a job that depends on the current

I disagree, btw the vm image used on GitHub contains kubectl https://github.com/actions/runner-images/blob/ubuntu24/20250126.1/images/ubuntu/Ubuntu2404-Readme.md#tools

So you don't observe that your workflow might be broken?

You could download it if you like, its tag full-24.04 of the default images listed in the act user guide runner page

scripts in the following step/s

I agree about this should work, is this broken?

<!-- gh-comment-id:2623240347 --> @ChristopherHX commented on GitHub (Jan 30, 2025): > * other scripts in the same step > * steps in a job that depends on the current I disagree, btw the vm image used on GitHub contains kubectl https://github.com/actions/runner-images/blob/ubuntu24/20250126.1/images/ubuntu/Ubuntu2404-Readme.md#tools So you don't observe that your workflow might be broken? You could download it if you like, its tag full-24.04 of the default images listed in the act user guide runner page > scripts in the following step/s I agree about this should work, is this broken?
Author
Owner

@gotha commented on GitHub (Jan 31, 2025):

it was unfortunate that I picked up a random binary to test with that accidentally exists in GHA, but not the local image.
I re-tested with cowsay and I can confirm that it works exactly like @ChristopherHX described.

It seems like the issue was with the pipeline itself. It can be resolved by either changing the pipeline or using the full image.

Thanks for the help @ChristopherHX

In case somebody tries to reproduce it:
test1.sh

#!/usr/bin/env bash

arch
case $(uname -m) in
    x86_64)             arch="x86_64" ;;
    arm|aarch64|arm64)  arch="arm" ;;
    *) exit 1 ;;
esac

today=$(date +'%Y-%m-%d')
cache_dir="${RUNNER_TOOL_CACHE}/tmp/${today}/${arch}"
mkdir -p "${cache_dir}/tmp"
install_dir="${cache_dir}/cowsay/bin/"
mkdir -p "${install_dir}"


url="https://github.com/Code-Hex/Neo-cowsay/releases/download/v2.0.4/cowsay_2.0.4_Linux_$arch.tar.gz"
echo $url
curl -sSLo "${cache_dir}/cowsay.tar.gz" "$url"
tar -xvzf "${cache_dir}/cowsay.tar.gz" -C "${cache_dir}/tmp"

mv ${cache_dir}/tmp/cowsay "${install_dir}/cowsay"
chmod +x "${install_dir}/cowsay"

echo 'Adding cowsay directory to PATH...'
echo "${install_dir}" >> "${GITHUB_PATH}"

test2.sh

#!/usr/bin/env bash

echo "which:"
which cowsay
echo "cowsay:"
cowsay "hello"
<!-- gh-comment-id:2626350902 --> @gotha commented on GitHub (Jan 31, 2025): it was unfortunate that I picked up a random binary to test with that accidentally exists in GHA, but not the local image. I re-tested with `cowsay` and I can confirm that it works exactly like @ChristopherHX described. It seems like the issue was with the pipeline itself. It can be resolved by either changing the pipeline or using the full image. Thanks for the help @ChristopherHX In case somebody tries to reproduce it: test1.sh ```sh #!/usr/bin/env bash arch case $(uname -m) in x86_64) arch="x86_64" ;; arm|aarch64|arm64) arch="arm" ;; *) exit 1 ;; esac today=$(date +'%Y-%m-%d') cache_dir="${RUNNER_TOOL_CACHE}/tmp/${today}/${arch}" mkdir -p "${cache_dir}/tmp" install_dir="${cache_dir}/cowsay/bin/" mkdir -p "${install_dir}" url="https://github.com/Code-Hex/Neo-cowsay/releases/download/v2.0.4/cowsay_2.0.4_Linux_$arch.tar.gz" echo $url curl -sSLo "${cache_dir}/cowsay.tar.gz" "$url" tar -xvzf "${cache_dir}/cowsay.tar.gz" -C "${cache_dir}/tmp" mv ${cache_dir}/tmp/cowsay "${install_dir}/cowsay" chmod +x "${install_dir}/cowsay" echo 'Adding cowsay directory to PATH...' echo "${install_dir}" >> "${GITHUB_PATH}" ``` test2.sh ```sh #!/usr/bin/env bash echo "which:" which cowsay echo "cowsay:" cowsay "hello" ```
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#1197
No description provided.