-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (41 loc) · 1.46 KB
/
trigger_demo_workflow.yaml
File metadata and controls
44 lines (41 loc) · 1.46 KB
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
name: Trigger Deploy to Demo
run-name: Trigger Deploy by @${{ github.actor }}
on:
#checkov:skip=CKV_GHA_7
workflow_dispatch:
inputs:
event_type:
type: choice
description: "The event type to trigger the workflow."
required: true
options:
- trigger-demo-plan
- trigger-demo-deploy
permissions:
contents: read
jobs:
trigger_demo_workflow:
runs-on: ubuntu-latest
steps:
- name: Deploy to Demo
env:
EVENT_TYPE_INPUT: ${{ github.event.inputs.event_type }}
run: |
EVENT_TYPE="$EVENT_TYPE_INPUT"
repo_owner="skylight-hq"
repo_name="dibbs-tf-envs"
service="dibbs-landing"
version="main"
response="$(curl -L -w '%{http_code}\n' -o /dev/null \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DIBBS_SKYLIGHT_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$EVENT_TYPE\", \"client_payload\": {\"version\": \"$version\", \"service\": \"$service\"}}")"
if [ $response -ne 204 ]; then
echo "Failed to trigger the workflow."
exit 1
fi
echo "View your workflow run at: https://github.com/skylight-hq/dibbs-tf-envs/actions"
echo "Successfully triggered the workflow."