Created
August 22, 2023 22:06
-
-
Save clarkritchie/d3c35a9feeec5ed62ddbb38172ee62c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: hello-world | |
on: | |
push: | |
branches-ignore: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'To what environment?' | |
type: choice | |
default: 'dev' | |
options: | |
- dev | |
- staging | |
- prod | |
jobs: | |
hello-job: | |
name: hello-world | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- name: nested-ternary | |
run: | | |
SECRET=${{ github.event.inputs.environment == 'dev' && secrets.DEV_SECRET || github.event.inputs.environment == 'staging' && secrets.STAGING_SECRET || secrets.PROD_SECRET }} | |
if [[ ${SECRET} == "xxx" ]]; then | |
echo "use the secret for dev" | |
elif [[ ${SECRET} == "yyy" ]]; then | |
echo "use the secret for staging" | |
else | |
echo "use the secret for prod" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment