[GH-ISSUE #2331] act fails to run bash passed as input to reusable workflow #1076

Closed
opened 2026-03-01 21:48:43 +03:00 by kerem · 3 comments
Owner

Originally created by @higaski on GitHub (May 17, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2331

Bug report info

act version:            0.2.62
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.2
        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,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
                CGO_ENABLED:          1
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
Docker Engine:
        Engine version:        26.1.2
        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.8.9-zen1-2-zen
        OS CPU:                16
        OS memory:             31241 MB
        Security options:
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act

Describe issue

I have a reusable workflow were certain prerequisites can be installed by passing a string to the workflow (e.g. sudo apt install stuff)

on:
  workflow_call:
    inputs:
      pre-build:
        description: 'Pre-build steps to run'
        default: ''
        required: false
        type: string

# see entire workflow below

    runs-on: ubuntu-22.04
    steps:
      - name: Run pre-build steps
        run: ${{ inputs.pre-build }} # this seems to fail?

This works on GitHub, but not locally. I get the following note:
docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
Then the workflow continuous as if there hasn't been an error.

No response

Workflow content

name: x86_64-linux-gnu-gcc

on:
  workflow_call:
    inputs:
      pre-build:
        description: 'Pre-build steps to run'
        default: ''
        required: false
        type: string
      args:
        description: 'Additional CMake arguments -D <var>[:<type>]=<value>'
        default: ''
        required: false
        type: string
      target:
        description: 'CMake targets to build'
        default: 'all'
        required: false
        type: string
      post-build:
        description: 'Post-build steps to run'
        default: ''
        required: false
        type: string
      upload-artifact:
        description: 'Upload build folder as artifact "build.tar"'
        default: false
        required: false
        type: boolean

jobs:
  x86_64-linux-gnu-gcc:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4.1.1
        with:
          fetch-depth: 0
      - name: Add toolchain PPA
        run: |
          sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
          sudo apt update -y
          sudo apt install -y gcc-13 g++-13
      - name: Run pre-build steps
        run: ${{ inputs.pre-build }}
      - run: cmake -Bbuild ${{ inputs.args }}
        env:
          CC:   gcc-13
          CXX:  g++-13
      - run: cmake --build build --parallel --target ${{ inputs.target }}
      - name: Run post-build steps
        run: ${{ inputs.post-build }}
      - if: ${{ inputs.upload-artifact }}
        run: tar -cvf build.tar build # https://github.com/actions/upload-artifact#limitations
      - if: ${{ inputs.upload-artifact }}
        uses: actions/upload-artifact@v3.1.3
        with:
          name: build.tar
          path: build.tar

Relevant log output

[tests/x86_64-linux-gnu-gcc/x86_64-linux-gnu-gcc]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
[tests/x86_64-linux-gnu-gcc/x86_64-linux-gnu-gcc]   ✅  Success - Main Run pre-build steps

Additional information

No response

Originally created by @higaski on GitHub (May 17, 2024). Original GitHub issue: https://github.com/nektos/act/issues/2331 ### Bug report info ```plain text act version: 0.2.62 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.2 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,tls10server=1,tlsrsakex=1,tlsunsafeekm=1 CGO_ENABLED: 1 GOARCH: amd64 GOOS: linux GOAMD64: v1 Docker Engine: Engine version: 26.1.2 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.8.9-zen1-2-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 reusable workflow were certain prerequisites can be installed by passing a string to the workflow (e.g. `sudo apt install stuff`) ```yml on: workflow_call: inputs: pre-build: description: 'Pre-build steps to run' default: '' required: false type: string # see entire workflow below runs-on: ubuntu-22.04 steps: - name: Run pre-build steps run: ${{ inputs.pre-build }} # this seems to fail? ``` This works on GitHub, but not locally. I get the following note: `docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=` Then the workflow continuous as if there hasn't been an error. ### Link to GitHub repository _No response_ ### Workflow content ```yml name: x86_64-linux-gnu-gcc on: workflow_call: inputs: pre-build: description: 'Pre-build steps to run' default: '' required: false type: string args: description: 'Additional CMake arguments -D <var>[:<type>]=<value>' default: '' required: false type: string target: description: 'CMake targets to build' default: 'all' required: false type: string post-build: description: 'Post-build steps to run' default: '' required: false type: string upload-artifact: description: 'Upload build folder as artifact "build.tar"' default: false required: false type: boolean jobs: x86_64-linux-gnu-gcc: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Add toolchain PPA run: | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt update -y sudo apt install -y gcc-13 g++-13 - name: Run pre-build steps run: ${{ inputs.pre-build }} - run: cmake -Bbuild ${{ inputs.args }} env: CC: gcc-13 CXX: g++-13 - run: cmake --build build --parallel --target ${{ inputs.target }} - name: Run post-build steps run: ${{ inputs.post-build }} - if: ${{ inputs.upload-artifact }} run: tar -cvf build.tar build # https://github.com/actions/upload-artifact#limitations - if: ${{ inputs.upload-artifact }} uses: actions/upload-artifact@v3.1.3 with: name: build.tar path: build.tar ``` ### Relevant log output ```sh [tests/x86_64-linux-gnu-gcc/x86_64-linux-gnu-gcc] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir= [tests/x86_64-linux-gnu-gcc/x86_64-linux-gnu-gcc] ✅ Success - Main Run pre-build steps ``` ### Additional information _No response_
kerem 2026-03-01 21:48:43 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@higaski commented on GitHub (May 17, 2024):

Hm, seems to have been some... caching issue?
I'll need to further investigate.

<!-- gh-comment-id:2118113637 --> @higaski commented on GitHub (May 17, 2024): Hm, seems to have been some... caching issue? I'll need to further investigate.
Author
Owner

@lamhktommy commented on GitHub (May 27, 2024):

Hi, I got the same issue on this. Is there any workaround / updates on the issue?

<!-- gh-comment-id:2133183130 --> @lamhktommy commented on GitHub (May 27, 2024): Hi, I got the same issue on this. Is there any workaround / updates on the issue?
Author
Owner

@higaski commented on GitHub (May 27, 2024):

Hi, I got the same issue on this. Is there any workaround / updates on the issue?

What recently worked for me was to explicitly pass the inputs to act, so, e.g., if we stick with my example above and we'd want to set the input string pre-build:

act --input pre-build=\"sudo apt install -y ninja-build\"

/edit
Sorry, forgot to mention that workaround here.

<!-- gh-comment-id:2133217147 --> @higaski commented on GitHub (May 27, 2024): > Hi, I got the same issue on this. Is there any workaround / updates on the issue? What recently worked for me was to explicitly pass the inputs to act, so, e.g., if we stick with my example above and we'd want to set the input string `pre-build`: ```sh act --input pre-build=\"sudo apt install -y ninja-build\" ``` /edit Sorry, forgot to mention that workaround here.
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#1076
No description provided.