You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: 'ID of the vault secret, only necessary if your vault secret differs from the job number in the repo name.'
7
+
default: ''
8
+
environment_override:
9
+
type: string
10
+
description: 'Override the environment detection logic and explicitly set the environment'
11
+
required: false
12
+
default: ''
13
+
outputs:
14
+
environment:
15
+
description: "The name of the environment to use. Value is based off the branch name or based on the 'Environment' input variable from the manual action."
- name: Set Environment Based On Branch, input variable, or override
58
+
id: environment
59
+
run: |
60
+
PUSH_EVENT=false
61
+
MANUAL_EVENT=false
62
+
63
+
echo "INPUTS: ${{ toJson(inputs) }}"
64
+
echo "GITHUB: ${{ toJson(github) }}"
65
+
66
+
# Check for environment override first
67
+
if [ ! -z "${{ inputs.environment_override }}" ]
68
+
then
69
+
ENVIRONMENT="${{ inputs.environment_override }}"
70
+
MANUAL_EVENT=true
71
+
elif [ ${{ github.event_name}} == "push" ]
72
+
then
73
+
if [[ ${{ steps.branchName.outputs.current_branch }} =~ ^feature/patch-.*$ ]]; then
74
+
ENVIRONMENT="dev"
75
+
elif [[ ${{ steps.branchName.outputs.current_branch }} =~ ^release/patch-.*$ ]]; then
76
+
ENVIRONMENT="qa"
77
+
elif [[ ${{ steps.branchName.outputs.current_branch }} == "master" ]]; then
78
+
ENVIRONMENT="prod"
79
+
elif [[ ${{ steps.branchName.outputs.current_branch }} == "release-next" ]]; then
80
+
ENVIRONMENT="stage"
81
+
else
82
+
ENVIRONMENT=$(echo ${{ steps.branchName.outputs.current_branch }} | sed 's/feature\//dev-/g' | sed 's/release\//qa-/g' | sed 's/dev\//dev-/g' | sed 's/hotfix\//hotfix-/g')
0 commit comments