-
Notifications
You must be signed in to change notification settings - Fork 24
38 lines (34 loc) · 1.42 KB
/
trigger-dispatch.yaml
File metadata and controls
38 lines (34 loc) · 1.42 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
name: Send repository update event
on:
push:
branches:
- main
permissions:
contents: read
jobs:
trigger-module-update-event:
runs-on: ubuntu-latest
strategy:
matrix:
repos: [intel-retail/automated-self-checkout, intel-retail/loss-prevention, intel-retail/order-accuracy]
steps:
- name: Send module update event to repo ${{ matrix.repos }}
run: |
echo "Sending repository dispatch event..."
response=$(curl -w "HTTPSTATUS:%{http_code}" -s \
-H "Accept: application/vnd.github.nebula-preview+json" \
-H "Authorization: token ${{ secrets.EVENT_DISPATCH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-X POST https://api.github.com/repos/${{ matrix.repos }}/dispatches \
-d '{"event_type":"dispatch-event","client_payload":{"unit":false,"integration":true}}' 2>&1)
# Extract HTTP status code and response body
http_code=$(echo "$response" | grep -o "HTTPSTATUS:[0-9]*" | cut -d: -f2)
response_body=$(echo "$response" | sed 's/HTTPSTATUS:[0-9]*$//')
# Handle response codes - success or failure
if [ "$http_code" = "204" ]; then
echo "Success: Repository dispatch event sent successfully"
else
echo "Failure: HTTP $http_code"
echo "Response: $response_body"
exit 1
fi