[GH-ISSUE #2217] If using workflow_call and matrix inputs are not being taken in consideration by second workflow #1042

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

Originally created by @maonat on GitHub (Feb 12, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2217

Bug report info

act version:            0.2.59
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 12
Docker host:            unix:///Users/username/.colima/default/docker.sock
Sockets found:
        /var/run/docker.sock
        $HOME/.colima/docker.sock
        $HOME/.docker/run/docker.sock
Config files:           
        /Users/username/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:full-latest
                -P ubuntu-latest=catthehacker/ubuntu:full-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:full-18.04
Build info:
        Go version:            go1.21.6
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.59
                DefaultGODEBUG:       panicnil=1
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        24.0.7
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 23.10
        OS type:               linux
        OS version:            23.10
        OS arch:               aarch64
        OS kernel:             6.5.0-17-generic
        OS CPU:                4
        OS memory:             7922 MB
        Security options:
                name=apparmor
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act -v workflow_dispatch -P self-hosted=my_acr/my_image:latest -p=false -W .github/workflows/cron-check-environment.yml --container-daemon-socket '/Users/username/.colima/default/docker.sock' --container-architecture linux/amd64 --secret-file secrets.yml

Describe issue

When launching origin workflow, the other workflow called with workflow_dispatch detect the provided inputs (passed on the "with" key) but if inputs.value is being called within the child workflow, they're empty.

No response

Parent Workflow content

name: Cron shutdown environments

on:
  # schedule:
  #   - cron: '0 * * * MON-FRI' # Every hour at minute 0 from Monday to Friday - UTC
  workflow_dispatch:

jobs:
  preparation:
    runs-on: self-hosted
    outputs:
      env_to_start: ${{ steps.environment_list_population.outputs.env_to_start }}
      env_to_stop: ${{ steps.environment_list_population.outputs.env_to_stop }}
    
    steps:
      - name: Get all environments to execute
        id: environment_list_population
        run: |
          ENV_TO_STOP=";myenv1"
          # Preparing outputs
          ENV_TO_STOP=$(echo -n $ENV_TO_STOP | jq -R -s -c 'split(";") | map(select(length > 0))')
          echo "env_to_stop=$ENV_TO_STOP" >> $GITHUB_OUTPUT

  shutdown-environment:
    needs: preparation
    strategy:
      matrix:
        environment: ${{ fromJson(needs.preparation.outputs.env_to_stop) }}
      max-parallel: 10
    uses: ./.github/workflows/shutdown-environment.yml
    if: ${{ needs.preparation.outputs.env_to_stop != '[]' }}
    with:
      environment: ${{ matrix.environment }}
      title: ${{ matrix.environment }} - Automated Shutdown trigger by CRON

Child Workflow content


name: Shutdown environment
run-name: |
  ${{ inputs.title != '' && inputs.title || format('{0} {1}', inputs.environment, '- Manual Shutdown') }} by @${{ github.actor }}

on:
  workflow_call:
    inputs:
      environment:
        description: The environment that we want shutdown
        type: string
        required: true
      title:
        description: A custom title that can be used for this workflow run
        type: string
        required: false
      env-path:
        description: Path to the files where the environments files are located in the repository
        type: string
        required: false
  workflow_dispatch:
    inputs:
      environment:
        description: The environment that we want shutdown
        type: string
        required: true
      title:
        description: A custom title that can be used for this workflow run
        type: string
        required: false
      env-path:
        description: Path to the files where the environments files are located in the repository
        type: string
        required: false
        default: environments

env:
  ENV_PATH: ${{ github.event.inputs.env-path || 'environments' }}

jobs:
  preparation:
    runs-on: self-hosted

    steps:
      - name: 'Checkout'
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Check if environment secret file exists
        id: environment_secrets_exists
        run: |
          set -x
          echo "${{ inputs.title }}"
          ENV_NAME=$(echo ${{ inputs.environment }} | tr '[[:upper:]]' '[[:lower:]]')
          export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml
          if [[ ! -f $ENV_FILE ]]; then
            echo "Environment file does not exists in the environments directory! Exiting execution."
            exit 2
          fi

Relevant log output

[shutdown-environment/Shutdown environment/preparation] [DEBUG] expression '${{ matrix.environment }}' rewritten to 'format('{0}', matrix.environment)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] evaluating expression 'format('{0}', matrix.environment)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'format('{0}', matrix.environment)' evaluated to '%!t(string=myenv1)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] expression '${{ matrix.environment }} - Automated Shutdown trigger by CRON' rewritten to 'format('{0} - Automated Shutdown trigger by CRON', matrix.environment)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] evaluating expression 'format('{0} - Automated Shutdown trigger by CRON', matrix.environment)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'format('{0} - Automated Shutdown trigger by CRON', matrix.environment)' evaluated to '%!t(string=myenv1 - Automated Shutdown trigger by CRON)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] Loading revision from git directory
[shutdown-environment/Shutdown environment/preparation] [DEBUG] HEAD points to 'revision_id'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] using github ref: refs/heads/main
[shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'set -x
echo "${{ inputs.title }}"
ENV_NAME=$(echo ${{ inputs.environment }} | tr '[[:upper:]]' '[[:lower:]]')
export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml
if [[ ! -f $ENV_FILE ]]; then
  echo "Environment file does not exists in the environments directory! Exiting execution."
  exit 2
fi' rewritten to 'format('set -x
echo "{0}"
ENV_NAME=$(echo {1} | tr ''[[:upper:]]'' ''[[:lower:]]'')
export ENV_FILE=${{ENV_PATH}}/${{ENV_NAME}}.yml
if [[ ! -f $ENV_FILE ]]; then
  echo "Environment file does not exists in the environments directory! Exiting execution."
  exit 2
fi', inputs.title, inputs.environment)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] evaluating expression 'format('set -x
echo "{0}"
ENV_NAME=$(echo {1} | tr ''[[:upper:]]'' ''[[:lower:]]'')
export ENV_FILE=${{ENV_PATH}}/${{ENV_NAME}}.yml
if [[ ! -f $ENV_FILE ]]; then
  echo "Environment file does not exists in the environments directory! Exiting execution."
  exit 2
fi', inputs.title, inputs.environment)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'format('set -x
echo "{0}"
ENV_NAME=$(echo {1} | tr ''[[:upper:]]'' ''[[:lower:]]'')
export ENV_FILE=${{ENV_PATH}}/${{ENV_NAME}}.yml
if [[ ! -f $ENV_FILE ]]; then
  echo "Environment file does not exists in the environments directory! Exiting execution."
  exit 2
fi', inputs.title, inputs.environment)' evaluated to '%!t(string=set -x
echo ""
ENV_NAME=$(echo  | tr '[[:upper:]]' '[[:lower:]]')
export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml
if [[ ! -f $ENV_FILE ]]; then
  echo "Environment file does not exists in the environments directory! Exiting execution."
  exit 2
fi)'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] Wrote command 

set -x
echo ""
ENV_NAME=$(echo  | tr '[[:upper:]]' '[[:lower:]]')
export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml
if [[ ! -f $ENV_FILE ]]; then
  echo "Environment file does not exists in the environments directory! Exiting execution."
  exit 2
fi

 to 'workflow/environment_secrets_exists'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] Writing entry to tarball workflow/environment_secrets_exists len:245
[shutdown-environment/Shutdown environment/preparation] [DEBUG] Extracting content to '/var/run/act'
[shutdown-environment/Shutdown environment/preparation]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/environment_secrets_exists] user= workdir=
[shutdown-environment/Shutdown environment/preparation] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/environment_secrets_exists]'
[shutdown-environment/Shutdown environment/preparation] [DEBUG] Working directory '/Users/username/repos/ff/repo-name'
DEBU[0000] Saving notices etag=914e4f2c-2a73-4040-afb7-602be630d6dc 
DEBU[0000] No new notices                               
| + echo ''
| 
| ++ echo
| ++ tr '[[:upper:]]' '[[:lower:]]'
| + ENV_NAME=
| + export ENV_FILE=environments/.yml
| + ENV_FILE=environments/.yml
| + [[ ! -f environments/.yml ]]
| + echo 'Environment file does not exists in the environments directory! Exiting execution.'
| Environment file does not exists in the environments directory! Exiting execution.
| + exit 2
[shutdown-environment/Shutdown environment/preparation]   ❌  Failure - Main Check if environment secret file exists
[shutdown-environment/Shutdown environment/preparation] exitcode '2': failure

Additional information

No response

Originally created by @maonat on GitHub (Feb 12, 2024). Original GitHub issue: https://github.com/nektos/act/issues/2217 ### Bug report info ```plain text act version: 0.2.59 GOOS: darwin GOARCH: arm64 NumCPU: 12 Docker host: unix:///Users/username/.colima/default/docker.sock Sockets found: /var/run/docker.sock $HOME/.colima/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/username/.actrc: -P ubuntu-latest=catthehacker/ubuntu:full-latest -P ubuntu-latest=catthehacker/ubuntu:full-20.04 -P ubuntu-18.04=catthehacker/ubuntu:full-18.04 Build info: Go version: go1.21.6 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.59 DefaultGODEBUG: panicnil=1 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin Docker Engine: Engine version: 24.0.7 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Ubuntu 23.10 OS type: linux OS version: 23.10 OS arch: aarch64 OS kernel: 6.5.0-17-generic OS CPU: 4 OS memory: 7922 MB Security options: name=apparmor name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act -v workflow_dispatch -P self-hosted=my_acr/my_image:latest -p=false -W .github/workflows/cron-check-environment.yml --container-daemon-socket '/Users/username/.colima/default/docker.sock' --container-architecture linux/amd64 --secret-file secrets.yml ``` ### Describe issue When launching origin workflow, the other workflow called with workflow_dispatch detect the provided inputs (passed on the "with" key) but if inputs.value is being called within the child workflow, they're empty. ### Link to GitHub repository _No response_ ### Parent Workflow content ```yml name: Cron shutdown environments on: # schedule: # - cron: '0 * * * MON-FRI' # Every hour at minute 0 from Monday to Friday - UTC workflow_dispatch: jobs: preparation: runs-on: self-hosted outputs: env_to_start: ${{ steps.environment_list_population.outputs.env_to_start }} env_to_stop: ${{ steps.environment_list_population.outputs.env_to_stop }} steps: - name: Get all environments to execute id: environment_list_population run: | ENV_TO_STOP=";myenv1" # Preparing outputs ENV_TO_STOP=$(echo -n $ENV_TO_STOP | jq -R -s -c 'split(";") | map(select(length > 0))') echo "env_to_stop=$ENV_TO_STOP" >> $GITHUB_OUTPUT shutdown-environment: needs: preparation strategy: matrix: environment: ${{ fromJson(needs.preparation.outputs.env_to_stop) }} max-parallel: 10 uses: ./.github/workflows/shutdown-environment.yml if: ${{ needs.preparation.outputs.env_to_stop != '[]' }} with: environment: ${{ matrix.environment }} title: ${{ matrix.environment }} - Automated Shutdown trigger by CRON ``` ### Child Workflow content ```yml name: Shutdown environment run-name: | ${{ inputs.title != '' && inputs.title || format('{0} {1}', inputs.environment, '- Manual Shutdown') }} by @${{ github.actor }} on: workflow_call: inputs: environment: description: The environment that we want shutdown type: string required: true title: description: A custom title that can be used for this workflow run type: string required: false env-path: description: Path to the files where the environments files are located in the repository type: string required: false workflow_dispatch: inputs: environment: description: The environment that we want shutdown type: string required: true title: description: A custom title that can be used for this workflow run type: string required: false env-path: description: Path to the files where the environments files are located in the repository type: string required: false default: environments env: ENV_PATH: ${{ github.event.inputs.env-path || 'environments' }} jobs: preparation: runs-on: self-hosted steps: - name: 'Checkout' uses: actions/checkout@v3 with: fetch-depth: 0 - name: Check if environment secret file exists id: environment_secrets_exists run: | set -x echo "${{ inputs.title }}" ENV_NAME=$(echo ${{ inputs.environment }} | tr '[[:upper:]]' '[[:lower:]]') export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi ``` ### Relevant log output ```sh [shutdown-environment/Shutdown environment/preparation] [DEBUG] expression '${{ matrix.environment }}' rewritten to 'format('{0}', matrix.environment)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] evaluating expression 'format('{0}', matrix.environment)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'format('{0}', matrix.environment)' evaluated to '%!t(string=myenv1)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] expression '${{ matrix.environment }} - Automated Shutdown trigger by CRON' rewritten to 'format('{0} - Automated Shutdown trigger by CRON', matrix.environment)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] evaluating expression 'format('{0} - Automated Shutdown trigger by CRON', matrix.environment)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'format('{0} - Automated Shutdown trigger by CRON', matrix.environment)' evaluated to '%!t(string=myenv1 - Automated Shutdown trigger by CRON)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] Loading revision from git directory [shutdown-environment/Shutdown environment/preparation] [DEBUG] HEAD points to 'revision_id' [shutdown-environment/Shutdown environment/preparation] [DEBUG] using github ref: refs/heads/main [shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'set -x echo "${{ inputs.title }}" ENV_NAME=$(echo ${{ inputs.environment }} | tr '[[:upper:]]' '[[:lower:]]') export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi' rewritten to 'format('set -x echo "{0}" ENV_NAME=$(echo {1} | tr ''[[:upper:]]'' ''[[:lower:]]'') export ENV_FILE=${{ENV_PATH}}/${{ENV_NAME}}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi', inputs.title, inputs.environment)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] evaluating expression 'format('set -x echo "{0}" ENV_NAME=$(echo {1} | tr ''[[:upper:]]'' ''[[:lower:]]'') export ENV_FILE=${{ENV_PATH}}/${{ENV_NAME}}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi', inputs.title, inputs.environment)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] expression 'format('set -x echo "{0}" ENV_NAME=$(echo {1} | tr ''[[:upper:]]'' ''[[:lower:]]'') export ENV_FILE=${{ENV_PATH}}/${{ENV_NAME}}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi', inputs.title, inputs.environment)' evaluated to '%!t(string=set -x echo "" ENV_NAME=$(echo | tr '[[:upper:]]' '[[:lower:]]') export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi)' [shutdown-environment/Shutdown environment/preparation] [DEBUG] Wrote command set -x echo "" ENV_NAME=$(echo | tr '[[:upper:]]' '[[:lower:]]') export ENV_FILE=${ENV_PATH}/${ENV_NAME}.yml if [[ ! -f $ENV_FILE ]]; then echo "Environment file does not exists in the environments directory! Exiting execution." exit 2 fi to 'workflow/environment_secrets_exists' [shutdown-environment/Shutdown environment/preparation] [DEBUG] Writing entry to tarball workflow/environment_secrets_exists len:245 [shutdown-environment/Shutdown environment/preparation] [DEBUG] Extracting content to '/var/run/act' [shutdown-environment/Shutdown environment/preparation] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/environment_secrets_exists] user= workdir= [shutdown-environment/Shutdown environment/preparation] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/environment_secrets_exists]' [shutdown-environment/Shutdown environment/preparation] [DEBUG] Working directory '/Users/username/repos/ff/repo-name' DEBU[0000] Saving notices etag=914e4f2c-2a73-4040-afb7-602be630d6dc DEBU[0000] No new notices | + echo '' | | ++ echo | ++ tr '[[:upper:]]' '[[:lower:]]' | + ENV_NAME= | + export ENV_FILE=environments/.yml | + ENV_FILE=environments/.yml | + [[ ! -f environments/.yml ]] | + echo 'Environment file does not exists in the environments directory! Exiting execution.' | Environment file does not exists in the environments directory! Exiting execution. | + exit 2 [shutdown-environment/Shutdown environment/preparation] ❌ Failure - Main Check if environment secret file exists [shutdown-environment/Shutdown environment/preparation] exitcode '2': failure ``` ### Additional information _No response_
kerem 2026-03-01 21:48:27 +03:00
Author
Owner

@ships commented on GitHub (Feb 15, 2024):

Looks the same as https://github.com/nektos/act/issues/2046

<!-- gh-comment-id:1945216162 --> @ships commented on GitHub (Feb 15, 2024): Looks the same as https://github.com/nektos/act/issues/2046
Author
Owner

@github-actions[bot] commented on GitHub (Aug 14, 2024):

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

<!-- gh-comment-id:2287465952 --> @github-actions[bot] commented on GitHub (Aug 14, 2024): Issue is stale and will be closed in 14 days unless there is new activity
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#1042
No description provided.