@@ -2,7 +2,7 @@ name: E2E Tests
2
2
3
3
on :
4
4
schedule :
5
- - cron : ' 0 0 * * *'
5
+ - cron : " 0 0 * * *"
6
6
push :
7
7
branches :
8
8
- main
11
11
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD : 1
12
12
PLAYWRIGHT_BROWSERS_PATH : 0
13
13
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
14
+ DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
14
15
15
16
permissions :
16
17
id-token : write # This is required for requesting the JWT
48
49
else
49
50
previous_version=""
50
51
fi
51
-
52
+
52
53
if [ "$latest_version" != "$previous_version" ]; then
53
54
echo "Versions are different. Continuing the pipeline."
54
55
else
@@ -61,14 +62,13 @@ jobs:
61
62
previousNextVersion : ${{ steps.get_latest_version.outputs.LATEST_VERSION }}
62
63
cacheKey : ${{ steps.cache-previous.outputs.cache-primary-key }}
63
64
64
- # If the event is push (merged and pushed into main) or if
65
+ # If the event is push (merged and pushed into main) or if
65
66
# the latest Nextjs version hasn't been tested, run the Playwright tests
66
67
e2e :
67
68
needs : check_next_version
68
69
if : github.event_name == 'push' || needs.check_next_version.outputs.skip != 'true'
69
70
runs-on : ubuntu-latest
70
71
steps :
71
-
72
72
- name : Checkout code
73
73
uses : actions/checkout@v3
74
74
@@ -154,9 +154,52 @@ jobs:
154
154
- name : Store Latest Version
155
155
run : |
156
156
echo "${{ needs.check_next_version.outputs.previousNextVersion }}" > previous_version.txt
157
-
157
+
158
158
- name : Cache Previous Version
159
159
uses : actions/cache/save@v3
160
160
with :
161
161
path : previous_version.txt
162
162
key : ${{ needs.check_next_version.outputs.cacheKey }}
163
+
164
+ # ############################
165
+ # Report status to Discord
166
+ # ############################
167
+ - name : Report success
168
+ if : success()
169
+ run : |
170
+ curl -X POST "$DISCORD_WEBHOOK" \
171
+ -H "Content-Type: application/json" \
172
+ -d '{
173
+ "username": "OpenNext E2E Test",
174
+ "avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
175
+ "embeds": [
176
+ {
177
+ "description": "Test succeeded — [view results](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}})",
178
+ "color": 3061373,
179
+ "footer": {
180
+ "text": "Woah! So cool!",
181
+ "icon_url": "https://i.imgur.com/u2ENxCk.png"
182
+ }
183
+ }
184
+ ]
185
+ }'
186
+
187
+ - name : Report failure
188
+ if : failure()
189
+ run : |
190
+ curl -X POST "$DISCORD_WEBHOOK" \
191
+ -H "Content-Type: application/json" \
192
+ -d '{
193
+ "username": "OpenNext E2E Test",
194
+ "avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
195
+ "embeds": [
196
+ {
197
+ "description": "Test failed — [view results](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}})",
198
+ "color": 14687834,
199
+ "footer": {
200
+ "text": "Hmmm...",
201
+ "icon_url": "https://i.imgur.com/QeXzqIy.png"
202
+ }
203
+ }
204
+ ]
205
+ }'
0 commit comments