test env workflow #1
Workflow file for this run
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: Test ENV NAME | ||
on: | ||
push: | ||
branches: | ||
- 'chore/hide_env_names' | ||
paths: | ||
- 'api/**' | ||
- 'client/**' | ||
- 'tiler/**' | ||
- '.github/**' | ||
workflow_dispatch: | ||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
env_name: ${{ steps.set_env_name.outputs.env_name }} | ||
steps: | ||
- name: Set ENV_NAME | ||
id: set_env_name | ||
run: | | ||
Check failure on line 22 in .github/workflows/test_env.yml GitHub Actions / Test ENV NAMEInvalid workflow file
|
||
BRANCH_NAME="${GITHUB_REF#refs/heads/}" | ||
if [[ "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == "staging" || "$BRANCH_NAME" == "test" || "$BRANCH_NAME" == "dev" ]]; then | ||
echo "ENV_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
echo "::set-output name=env_name::$BRANCH_NAME" | ||
else | ||
SECRET_NAME="SECRET_${BRANCH_NAME^^}" | ||
ENV_VALUE=$(echo ${{ secrets[SECRET_NAME] }}) | ||
echo "ENV_NAME=$ENV_VALUE" >> $GITHUB_ENV | ||
echo "::set-output name=env_name::$ENV_VALUE" | ||
fi | ||
print_env_name: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- name: Print ENV_NAME | ||
run: echo "ENV_NAME is ${{ needs.setup.outputs.env_name }}" | ||