Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsisten comparison of boolean inputs between workflow_dispatch and workflow_call #3571

Open
tomsit-ionos opened this issue Nov 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@tomsit-ionos
Copy link

Describe the bug

Comparing a boolean input in a workflow_call must be done against a boolean value and always yields false otherwise.

Comparing a boolean input in a workflow_dispatch must be done against a string value and always yields false otherwise.

To Reproduce

GIVEN a workflow_call with:

 on:
  workflow_dispatch:
      dry_run:
        required: false
        default: true
  workflow_call:
      dry_run:
        required: false
        default: true

WHEN evaluating the input dry_run yields:

 # for the workflow_call event
 echo "dry_run=${{ inputs.dry_run == 'false'}}" # -> false
 echo "dry_run=${{ inputs.dry_run == 'true'}}" # -> false
 echo "dry_run=${{ inputs.dry_run == true }}" # -> true
 
 # for the workflow_dispatch event
 echo "dry_run=${{ inputs.dry_run == 'false'}}" # -> false
 echo "dry_run=${{ inputs.dry_run == 'true'}}" # -> true
 echo "dry_run=${{ inputs.dry_run == true }}" # -> false

PS:

  • the example is from a step..run but this at least happens also in a job.<id>.if):

  • for extra confusion serves this (correct behaving) bash comparison which works for both events:

    if [[ "${{ inputs.dry_run }}" == "true" ]] ;

Expected behavior

In dependent of the event, the behavior should be the same.

Thoughts on fixing/mitigating this fast(ish)

I guess aligning this is going to breaking existing workflows.

Hence, in the meantime:

  1. this totally unexpected behavior must be guarded with a syntax error/warning during workflow execution, when attempting a comparison of incompatible types yielding always false as a result.
  2. the inconsistent behavior should be documented on the respective event's documentation.

Runner Version and Platform

Current runner version: '2.320.0'

Ubuntu
22.04.5
LTS

@tomsit-ionos tomsit-ionos added the bug Something isn't working label Nov 14, 2024
@tomsit-ionos tomsit-ionos changed the title inconsisten boolean inputs comparison between workflow_dispatch and workflow_dispatch inconsisten comparison of boolean inputs between workflow_dispatch and workflow_dispatch Nov 14, 2024
@tomsit-ionos tomsit-ionos changed the title inconsisten comparison of boolean inputs between workflow_dispatch and workflow_dispatch inconsisten comparison of boolean inputs between workflow_dispatch and workflow_call Nov 14, 2024
@tomsit-ionos
Copy link
Author

re-found this post https://github.com/orgs/community/discussions/9343

@tomsit-ionos
Copy link
Author

and related bug #2238

@nkilchenmann
Copy link

Facing a similar problem at the moment: https://stackoverflow.com/questions/79187883/ternary-operator-evaluating-wrongly

@nkilchenmann
Copy link

Facing a similar problem at the moment: https://stackoverflow.com/questions/79187883/ternary-operator-evaluating-wrongly

Update: This is unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants