[GH-ISSUE #2046] Can't pass reusable workflow input variable #980

Closed
opened 2026-03-01 21:47:54 +03:00 by kerem · 4 comments
Owner

Originally created by @haritowa on GitHub (Oct 12, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/2046

Bug report info

act version:            0.2.52
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:           
        /Users/haritowa/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:full-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-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.21.1
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.52
                DefaultGODEBUG:       panicnil=1
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        23.0.5
        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:             5.15.49-linuxkit
        OS CPU:                4
        OS memory:             9951 MB
        Security options:
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act -W .github/workflows/base.yml --container-architecture linux/amd64 --secret-file my.secrets  --var-file my.variables --input-file my.input

Describe issue

Workflow input is not propagated to called workflow

No response

Workflow content

## BASE

name: 'Core Workflow'

on:
  workflow_call:
    inputs:
      name:
        type: string
        required: true
      project:
        type: string
        required: true
      owner:
        type: string
        required: true
      options:
        type: string
        required: true

jobs:
  check-availability:
    uses: ./.github/workflows/base/check-availability.yml
    with:
      kek: "1"

## CALLED
name: 'Check mapping availability'

on:
  workflow_call:
    inputs:
      kek:
        type: string
        required: true

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Print workflow inputs
        run: |
          echo "${{ toJSON(inputs) }}"

Relevant log output

[check-availability/Check mapping availability/run]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir=
| {
|   kek: 
| }

Additional information

No response

Originally created by @haritowa on GitHub (Oct 12, 2023). Original GitHub issue: https://github.com/nektos/act/issues/2046 ### Bug report info ```plain text act version: 0.2.52 GOOS: darwin GOARCH: arm64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/haritowa/.actrc: -P ubuntu-latest=catthehacker/ubuntu:full-latest -P ubuntu-22.04=catthehacker/ubuntu:act-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.21.1 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.52 DefaultGODEBUG: panicnil=1 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin Docker Engine: Engine version: 23.0.5 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: 5.15.49-linuxkit OS CPU: 4 OS memory: 9951 MB Security options: name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act -W .github/workflows/base.yml --container-architecture linux/amd64 --secret-file my.secrets --var-file my.variables --input-file my.input ``` ### Describe issue Workflow input is not propagated to called workflow ### Link to GitHub repository _No response_ ### Workflow content ```yml ## BASE name: 'Core Workflow' on: workflow_call: inputs: name: type: string required: true project: type: string required: true owner: type: string required: true options: type: string required: true jobs: check-availability: uses: ./.github/workflows/base/check-availability.yml with: kek: "1" ## CALLED name: 'Check mapping availability' on: workflow_call: inputs: kek: type: string required: true jobs: run: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Print workflow inputs run: | echo "${{ toJSON(inputs) }}" ``` ### Relevant log output ```sh [check-availability/Check mapping availability/run] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir= | { | kek: | } ``` ### Additional information _No response_
kerem 2026-03-01 21:47:54 +03:00
Author
Owner

@haritowa commented on GitHub (Oct 12, 2023):

Yet it works if I change base workflow trigger to workflow_dispatch

<!-- gh-comment-id:1760049184 --> @haritowa commented on GitHub (Oct 12, 2023): Yet it works if I change base workflow trigger to `workflow_dispatch`
Author
Owner

@mconigliaro commented on GitHub (Oct 12, 2023):

Confirmed. I have to set inputs for the called workflow myself.

<!-- gh-comment-id:1760512899 --> @mconigliaro commented on GitHub (Oct 12, 2023): Confirmed. I have to set inputs for the called workflow myself.
Author
Owner

@github-actions[bot] commented on GitHub (Apr 10, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2046228423 --> @github-actions[bot] commented on GitHub (Apr 10, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@kittydoor commented on GitHub (Jul 10, 2024):

This issue is still relevant for me on act version 0.2.64.


Further debugging reveals more information.

The issue of "null input" only occurs when you trigger a workflow_call only workflow (i.e. act workflow_call -W ./my/workflow.yml), which then calls another workflow.

For the first workflow if you add on: push and run the same workflow file (i.e. act -W ./my/workflow.yml, the input is passed properly because now the "first" started workflow is not a workflow_call only one.

A decent workaround is to wrap the first workflow_call with another workflow of push or workflow_dispatch type, rather than calling it directly, emulating how it would be called by GitHub Actions.

Example for @haritowa's workflows:

# filename act_dispatch.yml
name: "My Workflow Caller"
on:
  workflow_dispatch:
jobs:
  call:
    uses: ./.github/workflows/base.yml
    with:
      name: Foo
      project: Bar
      owner: Baz
      options: FooBar
<!-- gh-comment-id:2220580790 --> @kittydoor commented on GitHub (Jul 10, 2024): This issue is still relevant for me on act version 0.2.64. --- Further debugging reveals more information. The issue of "null input" only occurs when you trigger a `workflow_call` only workflow (i.e. `act workflow_call -W ./my/workflow.yml`), which then calls another workflow. For the first workflow if you add `on: push` and run the same workflow file (i.e. `act -W ./my/workflow.yml`, the input is passed properly because now the "first" started workflow is not a `workflow_call` only one. A decent workaround is to wrap the first `workflow_call` with another workflow of `push` or `workflow_dispatch` type, rather than calling it directly, emulating how it would be called by GitHub Actions. Example for @haritowa's workflows: ``` # filename act_dispatch.yml name: "My Workflow Caller" on: workflow_dispatch: jobs: call: uses: ./.github/workflows/base.yml with: name: Foo project: Bar owner: Baz options: FooBar ```
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#980
No description provided.