Skip to content

Reusable workflow input with default string is not used when the calling input passed an empty string. #2907

Description

@sqin2019

Describe the bug
Reusable workflow input (string) with default is not used when the calling input passed an empty string.
To Reproduce
Steps to reproduce the behavior:

  1. reusable workflow
name: 'reusable_workflow'
on:
  workflow_call:
    inputs:
      message:
        description: 'message.'
        type: 'string'
        default: 'default message'
        required: false
jobs:
  print-inputs:
    runs-on: ubuntu-latest
    steps:
      - name: job summary
        run: |
          echo "message: ${{ inputs.message }}" >> $GITHUB_STEP_SUMMARY

  1. create a caller workflow that calls 1
name: 'caller'
on:
  workflow_dispatch:
    inputs:
      message:
        description: 'message'
        type: 'string'
        required: false
jobs:
  call-reusable-workflow:
    uses: '.../reusable-workflow.yml@main'
    with:
      message: ${{ inputs.message }}
  1. trigger the caller workflow without providing a message input

Expected behavior
should print message: default message

Job Log Output

But print message:

Runner Version and Platform

Version of your runner?

ubuntu-latest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions