Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

Commit 99c9a02

Browse files
committed
Enhancement: Restore auto-merge of dependabot pull requests
1 parent 82f4636 commit 99c9a02

File tree

4 files changed

+95
-98
lines changed

4 files changed

+95
-98
lines changed

.github/CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We are using [GitHub Actions](https://github.com/features/actions) as a continuo
55
For details, take a look at the following workflow configuration files:
66

77
- [`workflows/integrate.yaml`](workflows/integrate.yaml)
8+
- [`workflows/merge.yaml`](workflows/merge.yaml)
89
- [`workflows/prune.yaml`](workflows/prune.yaml)
910
- [`workflows/release.yaml`](workflows/release.yaml)
1011
- [`workflows/renew.yaml`](workflows/renew.yaml)

.github/settings.yml

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ labels:
6060
color: "0e8a16"
6161
description: ""
6262

63-
- name: "merge"
64-
color: "6f42c1"
65-
description: ""
66-
6763
- name: "question"
6864
color: "cc317c"
6965
description: ""

.github/workflows/integrate.yaml

-94
Original file line numberDiff line numberDiff line change
@@ -336,97 +336,3 @@ jobs:
336336

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

.github/workflows/merge.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# https://docs.github.com/en/actions
2+
3+
name: "Merge"
4+
5+
on: # yamllint disable-line rule:truthy
6+
workflow_run:
7+
types:
8+
- "completed"
9+
workflows:
10+
- "Integrate"
11+
12+
jobs:
13+
merge:
14+
name: "Merge"
15+
16+
runs-on: "ubuntu-latest"
17+
18+
if: >
19+
github.event.workflow_run.event == 'pull_request' &&
20+
github.event.workflow_run.conclusion == 'success' &&
21+
github.actor == 'dependabot[bot]' && (
22+
startsWith(github.event.workflow_run.head_commit.message, 'composer(deps-dev)') ||
23+
startsWith(github.event.workflow_run.head_commit.message, 'github-actions(deps)')
24+
)
25+
26+
steps:
27+
28+
- name: "Request review from @ergebnis-bot"
29+
uses: "actions/[email protected]"
30+
with:
31+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
32+
script: |
33+
const pullRequest = context.payload.workflow_run.pull_requests[0]
34+
const repository = context.repo
35+
36+
const reviewers = [
37+
"ergebnis-bot",
38+
]
39+
40+
await github.pulls.requestReviewers({
41+
owner: repository.owner,
42+
repo: repository.repo,
43+
pull_number: pullRequest.number,
44+
reviewers: reviewers,
45+
})
46+
47+
- name: "Assign @ergebnis-bot"
48+
uses: "actions/[email protected]"
49+
with:
50+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
51+
script: |
52+
const pullRequest = context.payload.workflow_run.pull_requests[0]
53+
const repository = context.repo
54+
55+
const assignees = [
56+
"ergebnis-bot",
57+
]
58+
59+
await github.issues.addAssignees({
60+
owner: repository.owner,
61+
repo: repository.repo,
62+
assignees: assignees,
63+
issue_number: pullRequest.number
64+
})
65+
66+
- name: "Approve pull request"
67+
uses: "actions/[email protected]"
68+
with:
69+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
70+
script: |
71+
const pullRequest = context.payload.workflow_run.pull_requests[0]
72+
const repository = context.repo
73+
74+
await github.pulls.createReview({
75+
event: "APPROVE",
76+
owner: repository.owner,
77+
repo: repository.repo,
78+
pull_number: pullRequest.number,
79+
})
80+
81+
- name: "Merge pull request"
82+
uses: "actions/[email protected]"
83+
with:
84+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
85+
script: |
86+
const pullRequest = context.payload.workflow_run.pull_requests[0]
87+
const repository = context.repo
88+
89+
await github.pulls.merge({
90+
merge_method: "merge",
91+
owner: repository.owner,
92+
pull_number: pullRequest.number,
93+
repo: repository.repo,
94+
})

0 commit comments

Comments
 (0)