@@ -332,3 +332,97 @@ jobs:
332
332
333
333
- name : " Run integration tests with phpunit/phpunit"
334
334
run : " vendor/bin/phpunit --configuration=test/Integration/phpunit.xml"
335
+
336
+ merge :
337
+ name : " Merge"
338
+
339
+ runs-on : " ubuntu-latest"
340
+
341
+ needs :
342
+ - " code-coverage"
343
+ - " coding-standards"
344
+ - " dependency-analysis"
345
+ - " mutation-tests"
346
+ - " static-code-analysis"
347
+ - " tests"
348
+
349
+ if : >
350
+ github.event_name == 'pull_request' &&
351
+ github.event.pull_request.draft == false && (
352
+ github.event.action == 'opened' ||
353
+ github.event.action == 'reopened' ||
354
+ github.event.action == 'synchronize'
355
+ ) && (
356
+ (github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'composer(deps-dev)')) ||
357
+ (github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'github-actions(deps)')) ||
358
+ (github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge'))
359
+ )
360
+
361
+ steps :
362
+ - name : " Request review from @ergebnis-bot"
363
+ uses : " actions/github-script@v5"
364
+ with :
365
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
366
+ script : |
367
+ const pullRequest = context.payload.pull_request
368
+ const repository = context.repo
369
+
370
+ const reviewers = [
371
+ "ergebnis-bot",
372
+ ]
373
+
374
+ await github.rest.pulls.requestReviewers({
375
+ owner: repository.owner,
376
+ repo: repository.repo,
377
+ pull_number: pullRequest.number,
378
+ reviewers: reviewers,
379
+ })
380
+
381
+ - name : " Assign @ergebnis-bot"
382
+ uses : " actions/github-script@v5"
383
+ with :
384
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
385
+ script : |
386
+ const pullRequest = context.payload.pull_request
387
+ const repository = context.repo
388
+
389
+ const assignees = [
390
+ "ergebnis-bot",
391
+ ]
392
+
393
+ await github.rest.issues.addAssignees({
394
+ owner: repository.owner,
395
+ repo: repository.repo,
396
+ issue_number: pullRequest.number
397
+ assignees: assignees,
398
+ })
399
+
400
+ - name : " Approve pull request"
401
+ uses : " actions/github-script@v5"
402
+ with :
403
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
404
+ script : |
405
+ const pullRequest = context.payload.pull_request
406
+ const repository = context.repo
407
+
408
+ await github.rest.pulls.createReview({
409
+ owner: repository.owner,
410
+ repo: repository.repo,
411
+ pull_number: pullRequest.number,
412
+ event: "APPROVE",
413
+ })
414
+
415
+ - name : " Merge pull request"
416
+ uses : " actions/github-script@v5"
417
+ with :
418
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
419
+ script : |
420
+ const pullRequest = context.payload.pull_request
421
+ const repository = context.repo
422
+
423
+ await github.rest.pulls.merge({
424
+ owner: repository.owner,
425
+ repo: repository.repo,
426
+ pull_number: pullRequest.number,
427
+ merge_method: "merge",
428
+ })
0 commit comments