Skip to content

Commit

Permalink
ch: refactor workflow for helpline-code-2
Browse files Browse the repository at this point in the history
  • Loading branch information
acedeywin committed Oct 26, 2023
1 parent 79f4e8e commit 2bb60be
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/deploy-multiple-accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,24 @@ jobs:
ssm_parameter: ${{env.TWILIO_SSM_PREFIX}}_POST_SURVEY_BOT_CHAT_URL
env_variable_name: POST_SURVEY_BOT_CHAT_URL

- name: Check matrix.helpline-code and set HELPLINE_CODE
- name: Set Helpline Code for E2E Account
if: matrix.helpline_code == 'E2E'
uses: marvinpinto/action-inject-ssm-secrets@latest
with:
ssm_parameter: ${{env.TWILIO_SSM_PREFIX}}_HELPLINE_CODE
env_variable_name: HELPLINE_CODE

- name: Check and Set Helpline Code
if: matrix.helpline_code == 'E2E'
run: |
echo "Setting helpline-code to $HELPLINE_CODE"
echo "HELPLINE_CODE=$HELPLINE_CODE" >> $GITHUB_ENV
- name: Set Helpline Code (else part)
if: matrix.helpline_code != 'E2E'
run: |
if [[ "${{ matrix.helpline_code }}" == "E2E" ]]; then
export HELPLINE_CODE="${{ matrix.helpline_code }}"
else
# Retrieve the SSM parameter and set HELPLINE_CODE
ssm_value=$(aws ssm get-parameter --name ${{ env.TWILIO_SSM_PREFIX }}_HELPLINE_CODE --query 'Parameter.Value' --output text)
export HELPLINE_CODE="${{ ssm_value }}"
fi
shell: bash

- name: Set Helpline Code
run: echo "HELPLINE_CODE=${{ env.HELPLINE_CODE }}" >> $GITHUB_ENV
echo "Setting helpline-code to matrix.helpline_code"
echo "HELPLINE_CODE=${{ matrix.helpline_code }}" >> $GITHUB_ENV
- name: Set AWS credentials for Aselo user
uses: marvinpinto/action-inject-ssm-secrets@latest
Expand Down Expand Up @@ -186,7 +191,7 @@ jobs:
aselo-app-secret-key: $ASELO_APP_SECRET_KEY
aws-region: $HELPLINE_AWS_REGION
s3-bucket: $S3_BUCKET
helpline-code: ${{env.HELPLINE_CODE}}
helpline-code: "${{ env.HELPLINE_CODE }}"
environment-code: ${{matrix.environment_code}}
environment: ${{env.FULL_ENVIRONMENT_NAME}}
# Set 'false' if the target environment is production OR the force_enable_operating_hours override option is checked - otherwise 'true'
Expand Down

0 comments on commit 2bb60be

Please sign in to comment.