Skip to content

Commit df98a63

Browse files
committed
restore merging of dependabot pull requests back to integrate workflow
- made possible by https://github.blog/changelog/2021-11-30-github-actions-workflows-triggered-by-dependabot-receive-dependabot-secrets/ - reverts ergebnis#759
1 parent a45d8a0 commit df98a63

File tree

2 files changed

+94
-93
lines changed

2 files changed

+94
-93
lines changed

.github/workflows/integrate.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,97 @@ jobs:
332332

333333
- name: "Run integration tests with phpunit/phpunit"
334334
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+
})

.github/workflows/merge.yaml

-93
This file was deleted.

0 commit comments

Comments
 (0)