Skip to content

Easily return one of many values based on many conditionals

License

Notifications You must be signed in to change notification settings

dkershner6/switch-case-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

switch-case-action

Easily return one of many values based on many conditionals.

conditionals-with-values

New lines are required between conditionals, what needs to occur for this switch case to work is for the word "true" to occur, then any amount of white space (or none) an arrow (=>) then any amount of whitespace. It will return all remaining text on that line.

Usage

      - uses: dkershner6/switch-case-action@v1
        id: switch-case
        with:
          default: "its the default"
          conditionals-with-values: |
            ${{ 'test' == 'not-test' }} => shouldnt be this one
            ${{ 'test' == 'test' }} => correctAnswer
          
      - run: echo ${{ steps.switch-case.outputs.value }} # correctAnswer
      - uses: dkershner6/switch-case-action@v1
        id: switch-case
        with:
          default: "its the default"
          conditionals-with-values: |
            ${{ 'test' == 'not-test' }} => shouldnt be this one
            ${{ 'test' == 'still-not-test' }} => shouldnt be this one, too
          
      - run: echo ${{ steps.switch-case.outputs.value }} # its the default

About

Easily return one of many values based on many conditionals

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published