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

Conditional running of action steps could be made more concise using run.steps[*].if #21

Open
chgl opened this issue Jul 7, 2023 · 1 comment

Comments

@chgl
Copy link

chgl commented Jul 7, 2023

I believe the conditional handling inside the action could be implemented more concisely by conditionally running steps based in the input instead of always running and checking inside a shell. E.g. instead of

- name: Check if .NET is installed
      run: |
        if $INPUT_DOTNET_VALIDATION_ENABLED || $INPUT_SUSHI_ENABLED; then
          if ! command -v dotnet &> /dev/null
          then
              echo "dotnet could not be found. Please see actions/setup-dotnet to set it up before running this action."
              exit 1
          fi
        fi
      shell: bash
- name: Check if .NET is installed
  if: ${{ inputs.DOTNET_VALIDATION_ENABLED || inputs.INPUT_SUSHI_ENABLED }}
      run: |
          if ! command -v dotnet &> /dev/null
          then
              echo "dotnet could not be found. Please see actions/setup-dotnet to set it up before running this action."
              exit 1
          fi
      shell: bash

This would show the Check if .NET is installed step as disabled in the GitHub workflow view.

(As another nit-picky aside: kebab-case for input parameters generally seems more common in GitHub actions)

@alexzautke
Copy link
Member

Thanks for the suggestion! This would definitely be a nice improvement, I didn't know that this was possible. A PR is very welcome here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants