-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (32 loc) · 1.03 KB
/
notify-ops.yml
File metadata and controls
34 lines (32 loc) · 1.03 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
name: Notify Ops Repo
on:
workflow_run:
workflows: ["Docker"]
types: [completed]
branches: [main]
jobs:
notify:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Trigger ops-repo deploy
env:
PAT: ${{ secrets.OPS_REPO_DISPATCH_PAT }}
run: |
if [ -z "$PAT" ]; then
echo "::error::OPS_REPO_DISPATCH_PAT secret is empty or unset"
exit 1
fi
status=$(curl -sS -o /tmp/resp.json -w "%{http_code}" \
-X POST \
-H "Authorization: Bearer $PAT" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/MrChengLen/filemorph-ops/dispatches \
-d '{"event_type":"filemorph-published"}')
echo "HTTP $status"
cat /tmp/resp.json
if [ "$status" != "204" ]; then
echo "::error::dispatch failed (expected 204)"
exit 1
fi