Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dkershner6/switch-case-action
Easily return one of many values based on many conditionals
https://github.com/dkershner6/switch-case-action
github-actions nodejs
Last synced: 29 days ago
JSON representation
Easily return one of many values based on many conditionals
- Host: GitHub
- URL: https://github.com/dkershner6/switch-case-action
- Owner: dkershner6
- License: mit
- Created: 2021-08-26T21:32:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-28T15:43:26.000Z (over 1 year ago)
- Last Synced: 2024-08-17T18:59:36.382Z (3 months ago)
- Topics: github-actions, nodejs
- Homepage:
- Size: 25.4 KB
- Stars: 6
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```yml
- 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
``````yml
- 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
```