Skip to content

Switch Case Action

Actions
Checks the conditionals-and-values input for the correct one, and if none found, returns default (like a switch case)
v1
Latest
Star (6)

Tags

 (1)

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

Switch Case Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Checks the conditionals-and-values input for the correct one, and if none found, returns default (like a switch case)
v1
Latest

Tags

 (1)

Switch Case Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.