forked from zingdevlimited/actions-helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
50 lines (47 loc) · 1.99 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: "Update Twilio Functions Variables"
description: Update the Environment Variables saved to a Twilio Functions Service
inputs:
SERVICE_NAME:
required: true
description: The unique name of the Twilio Functions Service
ENVIRONMENT_SUFFIX:
required: false
description: (Optional) The domain suffix of the Twilio Functions Environment
VARIABLES_ENV:
required: true
description: The Environment Variable key/value pairs to deploy (in .env format)
OPTIONAL_VARIABLES:
required: false
description: (Optional) List of Environment Variable keys that are optional. Will not error if empty, and will not delete existing value.
TWILIO_API_KEY:
required: true
description: Twilio API Key
TWILIO_API_SECRET:
required: true
description: Twilio API Secret
runs:
using: composite
steps:
- name: Validate Inputs
shell: bash
run: |
fail=""
[[ -z "${{ inputs.SERVICE_NAME }}" ]] && echo "::error::Missing SERVICE_NAME in inputs" && fail=1
[[ -z "${{ inputs.VARIABLES_ENV }}" ]] && echo "::error::Missing VARIABLES_ENV in inputs" && fail=1
[[ -z "${{ inputs.TWILIO_API_KEY }}" ]] && echo "::error::Missing TWILIO_API_KEY in inputs" && fail=1
[[ -z "${{ inputs.TWILIO_API_SECRET }}" ]] && echo "::error::Missing TWILIO_API_SECRET in inputs" && fail=1
[[ -n "$fail" ]] && exit 1 || exit 0
- name: Update Environment Variables for ${{ inputs.SERVICE_NAME }} ${{ inputs.ENVIRONMENT_SUFFIX }}
shell: bash
run: |
${{ github.action_path }}/update-functions-variables.sh \
"${{ inputs.SERVICE_NAME }}" \
"${{ inputs.ENVIRONMENT_SUFFIX }}" \
"$VARIABLES" \
"$OPTIONAL_VARIABLES"
env:
VARIABLES: ${{ inputs.VARIABLES_ENV }}
OPTIONAL_VARIABLES: ${{ inputs.OPTIONAL_VARIABLES }}
TWILIO_ACCOUNT_SID: ${{ inputs.TWILIO_ACCOUNT_SID }}
TWILIO_API_KEY: ${{ inputs.TWILIO_API_KEY }}
TWILIO_API_SECRET: ${{ inputs.TWILIO_API_SECRET }}