38
38
BUILD_CACHE_KEY : ${{ github.event.inputs.commit || github.sha }}
39
39
40
40
jobs :
41
+ job_get_metadata :
42
+ name : Get Metadata
43
+ runs-on : ubuntu-latest
44
+ steps :
45
+ - name : Check out current commit
46
+ uses : actions/checkout@v2
47
+ with :
48
+ ref : ${{ env.HEAD_COMMIT }}
49
+ # We need to check out not only the fake merge commit between the PR and the base branch which GH creates, but
50
+ # also its parents, so that we can pull the commit message from the head commit of the PR
51
+ fetch-depth : 2
52
+ - name : Get metadata
53
+ id : get_metadata
54
+ # We need to try a number of different options for finding the head commit, because each kind of trigger event
55
+ # stores it in a different location
56
+ run : |
57
+ COMMIT_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha || github.event.head_commit.id || env.HEAD_COMMIT }})
58
+ echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
59
+ echo "COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s $COMMIT_SHA)" >> $GITHUB_ENV
60
+ outputs :
61
+ commit_label : " ${{ env.COMMIT_SHA }}: ${{ env.COMMIT_MESSAGE }}"
62
+
41
63
job_install_deps :
42
64
name : Install Dependencies
65
+ needs : job_get_metadata
43
66
runs-on : ubuntu-latest
44
67
timeout-minutes : 15
45
68
steps :
46
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
69
+ - name : " Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})"
47
70
uses : actions/checkout@v2
48
71
with :
49
72
ref : ${{ env.HEAD_COMMIT }}
@@ -70,11 +93,11 @@ jobs:
70
93
71
94
job_build :
72
95
name : Build
73
- needs : job_install_deps
96
+ needs : [ job_get_metadata, job_install_deps ]
74
97
runs-on : ubuntu-latest
75
98
timeout-minutes : 20
76
99
steps :
77
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
100
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
78
101
uses : actions/checkout@v2
79
102
with :
80
103
ref : ${{ env.HEAD_COMMIT }}
@@ -150,13 +173,13 @@ jobs:
150
173
151
174
job_size_check :
152
175
name : Size Check
153
- needs : job_build
176
+ needs : [job_get_metadata, job_build]
154
177
timeout-minutes : 15
155
178
runs-on : ubuntu-latest
156
179
# Size Check will error out outside of the context of a PR
157
180
if : ${{ github.event_name == 'pull_request' }}
158
181
steps :
159
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
182
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
160
183
uses : actions/checkout@v2
161
184
with :
162
185
ref : ${{ env.HEAD_COMMIT }}
@@ -184,11 +207,11 @@ jobs:
184
207
185
208
job_lint :
186
209
name : Lint
187
- needs : job_build
210
+ needs : [job_get_metadata, job_build]
188
211
timeout-minutes : 10
189
212
runs-on : ubuntu-latest
190
213
steps :
191
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
214
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
192
215
uses : actions/checkout@v2
193
216
with :
194
217
ref : ${{ env.HEAD_COMMIT }}
@@ -211,11 +234,11 @@ jobs:
211
234
212
235
job_circular_dep_check :
213
236
name : Circular Dependency Check
214
- needs : job_build
237
+ needs : [job_get_metadata, job_build]
215
238
timeout-minutes : 10
216
239
runs-on : ubuntu-latest
217
240
steps :
218
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
241
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
219
242
uses : actions/checkout@v2
220
243
with :
221
244
ref : ${{ env.HEAD_COMMIT }}
@@ -238,12 +261,12 @@ jobs:
238
261
239
262
job_artifacts :
240
263
name : Upload Artifacts
241
- needs : job_build
264
+ needs : [job_get_metadata, job_build]
242
265
runs-on : ubuntu-latest
243
266
# Build artifacts are only needed for releasing workflow.
244
267
if : startsWith(github.ref, 'refs/heads/release/')
245
268
steps :
246
- - name : Check out current commit (${{ github.sha }})
269
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
247
270
uses : actions/checkout@v2
248
271
with :
249
272
ref : ${{ env.HEAD_COMMIT }}
@@ -275,15 +298,15 @@ jobs:
275
298
276
299
job_unit_test :
277
300
name : Test (Node ${{ matrix.node }})
278
- needs : job_build
301
+ needs : [job_get_metadata, job_build]
279
302
continue-on-error : true
280
303
timeout-minutes : 30
281
304
runs-on : ubuntu-latest
282
305
strategy :
283
306
matrix :
284
307
node : [8, 10, 12, 14, 16, 18]
285
308
steps :
286
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
309
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
287
310
uses : actions/checkout@v2
288
311
with :
289
312
ref : ${{ env.HEAD_COMMIT }}
@@ -312,15 +335,15 @@ jobs:
312
335
313
336
job_nextjs_integration_test :
314
337
name : Test @sentry/nextjs on (Node ${{ matrix.node }})
315
- needs : job_build
338
+ needs : [job_get_metadata, job_build]
316
339
continue-on-error : true
317
340
timeout-minutes : 30
318
341
runs-on : ubuntu-latest
319
342
strategy :
320
343
matrix :
321
344
node : [10, 12, 14, 16, 18]
322
345
steps :
323
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
346
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
324
347
uses : actions/checkout@v2
325
348
with :
326
349
ref : ${{ env.HEAD_COMMIT }}
@@ -349,12 +372,12 @@ jobs:
349
372
# separate job allows them to run in parallel with the other tests.
350
373
job_ember_tests :
351
374
name : Test @sentry/ember
352
- needs : job_build
375
+ needs : [job_get_metadata, job_build]
353
376
continue-on-error : true
354
377
timeout-minutes : 30
355
378
runs-on : ubuntu-latest
356
379
steps :
357
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
380
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
358
381
uses : actions/checkout@v2
359
382
with :
360
383
ref : ${{ env.HEAD_COMMIT }}
@@ -388,7 +411,7 @@ jobs:
388
411
389
412
job_browser_playwright_tests :
390
413
name : Playwright - ${{ (matrix.tracing_only && 'Browser + Tracing') || 'Browser' }} (${{ matrix.bundle }})
391
- needs : job_build
414
+ needs : [job_get_metadata, job_build]
392
415
runs-on : ubuntu-latest
393
416
strategy :
394
417
matrix :
@@ -410,7 +433,7 @@ jobs:
410
433
- bundle : cjs
411
434
tracing_only : false
412
435
steps :
413
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
436
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
414
437
uses : actions/checkout@v2
415
438
with :
416
439
ref : ${{ env.HEAD_COMMIT }}
@@ -439,7 +462,7 @@ jobs:
439
462
440
463
job_browser_integration_tests :
441
464
name : Old Browser Integration Tests (${{ matrix.browser }})
442
- needs : job_build
465
+ needs : [job_get_metadata, job_build]
443
466
runs-on : ubuntu-latest
444
467
timeout-minutes : 10
445
468
continue-on-error : true
@@ -450,7 +473,7 @@ jobs:
450
473
- FirefoxHeadless
451
474
- WebkitHeadless
452
475
steps :
453
- - name : Check out current commit (${{ env.HEAD_COMMIT }})
476
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
454
477
uses : actions/checkout@v2
455
478
with :
456
479
ref : ${{ env.HEAD_COMMIT }}
@@ -478,12 +501,12 @@ jobs:
478
501
479
502
job_browser_build_tests :
480
503
name : Browser Build Tests
481
- needs : job_build
504
+ needs : [job_get_metadata, job_build]
482
505
runs-on : ubuntu-latest
483
506
timeout-minutes : 5
484
507
continue-on-error : true
485
508
steps :
486
- - name : Check out current commit (${ env.HEAD_COMMIT }})
509
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
487
510
uses : actions/checkout@v2
488
511
with :
489
512
ref : ${{ env.HEAD_COMMIT }}
@@ -512,15 +535,15 @@ jobs:
512
535
513
536
job_node_integration_tests :
514
537
name : Node SDK Integration Tests (${{ matrix.node }})
515
- needs : job_build
538
+ needs : [job_get_metadata, job_build]
516
539
runs-on : ubuntu-latest
517
540
timeout-minutes : 10
518
541
continue-on-error : true
519
542
strategy :
520
543
matrix :
521
544
node : [10, 12, 14, 16, 18]
522
545
steps :
523
- - name : Check out current commit (${{ github.sha }})
546
+ - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
524
547
uses : actions/checkout@v2
525
548
with :
526
549
ref : ${{ env.HEAD_COMMIT }}
0 commit comments