-
Notifications
You must be signed in to change notification settings - Fork 102
29 lines (26 loc) · 1.27 KB
/
04-dispatch-event-workflow.yml
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
name: 04 - Remote Dispatch Action Initiator
on:
# push:
schedule:
- cron: '0 3 * * MON-FRI' # Runs at 3:00 UTC
repository_dispatch:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: INIT WORKFLOW - Dispatch init event to REMOTE repository
if: github.event.action != 'Formula Workflow Response'
run: |
curl -X POST https://api.github.com/repos/GuillaumeFalourd/ritchie-formulas-scheduler-demo/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "Start Formula Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- name: FORMULA RESPONSE - Response event from REMOTE repository
if: github.event.action == 'Formula Workflow Response'
run: |
echo "RESPONSE received from '${{ github.event.client_payload.repository }}'"
curl -X POST https://api.github.com/repos/GuillaumeFalourd/ritchie-formulas-scheduler-demo/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "Unexpected Event Demo", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'