question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reusable workflows do not respect conditional steps based on inputs.

See original GitHub issue

Describe the bug Reusable workflow does not respect conditional inputs. The current behavior is that they run all steps listed in the reusable workflow. This is related to #1602.

To Reproduce Steps to reproduce the behavior:

  1. Create a reusable workflow that uses inputs in its conditional steps.
  2. Run
  3. See error

Expected behavior That I can conditionally run steps in a reusable workflow.

Runner Version and Platform

Version of your runner? 2.304.0

OS of the machine running the runner? OSX/Windows/Linux/… macOS arm64

What’s not working?

My conditionals attached to steps in a reusable workflow should be respected. They are not and both steps will trigger.

image

Job Log Output

If applicable, include the relevant part of the job / step log output here. All sensitive information should already be masked out, but please double-check before pasting here.

Runner and Worker’s Diagnostic Logs

If applicable, add relevant diagnostic log information. Logs are located in the runner’s _diag folder. The runner logs are prefixed with Runner_ and the worker logs are prefixed with Worker_. Each job run correlates to a worker log. All sensitive information should already be masked out, but please double-check before pasting here.

Runner_20230612-205711-utc.log Worker_20230613-180512-utc.log

Issue Analytics

  • State:open
  • Created 3 months ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ChristopherHXcommented, Jun 13, 2023

if: ${{inputs.platform}} == 'android'

Not even the vscode actions linter complain about this not implemented syntax.

It is effectively the same as writing true, because the result of the if is a non empty string and not a boolean.

The runner and the Actions Service only supports something like

if: inputs.platform == 'android'

I would really expect an error message on the runner and service telling the workflow author there is a syntax error in the if expression

0reactions
jason-edstromcommented, Jun 14, 2023

I changed the conditionals to one of the formats I mentioned: if: ${{inputs.platform}} == android. I also removed the /dev/null. to bring back the failure state. It does look like the /dev/null was eating some logging.

mkdir: ./actions-runner-osx-arm64-2.304.0/_work/retail-mobile-apps-sandbox/retail-mobile-apps-sandbox/apps/rn-apps/mercury/codepush: File exists
Error: Process completed with exit code 1.

I ran this to see if mkdir with the directory existing causes a failure state:

mkdir ./apps/rn-apps/mercury/codepush; mkdir ./apps/rn-apps/mercury/codepush-2/

It doesn’t seem to block the successful execution of the second mkdir command. Does that seem accurate?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to run a reusable workflow conditionnaly?
I made some tests here and using if: ${{ inputs.skip == 'false' }} with single quotes ' doesn't work as you are comparing...
Read more >
GitHub Action Reusable Workflows With Multi Environments ...
1. SUBSCRIBE FOR MORE LEARNING : https://www.youtube.com/channel/UCv9MUffHWyo2GgLIDLVu0KQ ...
Read more >
How to start using reusable workflows with GitHub Actions
Reusable workflows offer a simple and powerful way to avoid copying and pasting workflows across your repositories.
Read more >
7 Github Actions Tricks I Wish I Knew Before I Started
#1: How to Use Github Action Triggers; #2: Reusable Workflows with ... Another conditional can be to not trigger certain jobs for drafts...
Read more >
Avoid Duplication! GitHub Actions Reusable Workflows
In the example above, where I want to use a reusable workflow as template to build and push a Docker Image to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found