-
Notifications
You must be signed in to change notification settings - Fork 11
168 lines (140 loc) · 9.63 KB
/
in-dispatch-out.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
on:
repository_dispatch:
types: [ping_book, ping_presentation]
name: receive-from-template-and-dispatch-to-workflows
jobs:
dispatch-received:
name: Dispatch received from the template changes
runs-on: ubuntu-latest
steps:
- name: Event Information
run: |
echo "Event '${{ github.event.action }}' received from '${{ github.event.client_payload.repository }}'"
download-changes-and-push:
name: Download template structure and push changes
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Download files from the presentation template repository
if: github.event.action == 'ping_presentation'
run: |
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR-fonts.css \
--output pres-en/qcbsR-fonts.css
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR.css \
--output pres-en/qcbsR.css
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR-header.html \
--output pres-en/qcbsR-header.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR-macros.js \
--output pres-en/qcbsR-macros.js
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR-fonts.css \
--output pres-fr/qcbsR-fonts.css
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR.css \
--output pres-fr/qcbsR.css
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR-header.html \
--output pres-fr/qcbsR-header.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/presentation-template/qcbsR-macros.js \
--output pres-fr/qcbsR-macros.js
- name: Download files from the book template repository
if: github.event.action == 'ping_book'
run: |
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-style.css \
--output book-en/assets/qcbs-style.css
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-hideOutput.js \
--output book-en/assets/qcbs-hideOutput.js
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-header.html \
--output book-en/assets/qcbs-header.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-footer.html \
--output book-en/assets/qcbs-footer.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-big-image.html \
--output book-en/assets/qcbs-big-image.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/_output.yml \
--output book-en/_output.yml
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-style.css \
--output book-fr/assets/qcbs-style.css
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-hideOutput.js \
--output book-fr/assets/qcbs-hideOutput.js
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-header.html \
--output book-fr/assets/qcbs-header.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-footer.html \
--output book-fr/assets/qcbs-footer.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/assets/qcbs-big-image.html \
--output book-fr/assets/qcbs-big-image.html
curl --header 'Authorization: token ${{ secrets.ACCESS_TOKEN }}' \
--header 'Accept: application/vnd.github.v3.raw' \
--location https://api.github.com/repos/QCBSRworkshops/templateWorkshops/contents/book-template/_output.yml \
--output book-fr/_output.yml
- name: List directories # May be removed soon
run: ls
- name: Commit and push changes to the current repository
run: |
git config --global user.name 'pedrohbraga'
git config --global user.email '[email protected]'
git add .
if [ -z "$(git status --porcelain)" ]; then
# Working directory clean
echo "No changes have been detected in the updated files."
else
echo "Differences detected between old and updated files. Proceeding with commit."
git commit -m "Automated commit triggered from repository dispatch: updating template structure"
git push
fi
dispatch-to-workflows:
name: Dispatch received from the template changes - Sending dispatch to workflows
needs: download-changes-and-push
runs-on: ubuntu-latest
steps:
- name: 📚 PONG BOOK - Dispatch response from received PING BOOK by triggering workflows
if: github.event.action == 'ping_book'
run: |
curl -X POST https://api.github.com/repos/QCBSRworkshops/workshop07/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "pong_book", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- name: 📺 PONG PRESENTATION - Dispatch response from received PING PRESENTATION by triggering workflows
if: github.event.action == 'ping_presentation'
run: |
curl -X POST https://api.github.com/repos/QCBSRworkshops/workshop07/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "pong_presentation", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'