Skip to content

Commit 9db92a4

Browse files
committed
Enhancement: Restore auto-merge of dependabot pull requests
1 parent 70c1b96 commit 9db92a4

File tree

5 files changed

+95
-98
lines changed

5 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
@@ -57,10 +57,6 @@ labels:
5757
color: "0e8a16"
5858
description: ""
5959

60-
- name: "merge"
61-
color: "6f42c1"
62-
description: ""
63-
6460
- name: "question"
6561
color: "cc317c"
6662
description: ""

.github/workflows/integrate.yaml

-94
Original file line numberDiff line numberDiff line change
@@ -330,97 +330,3 @@ jobs:
330330

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

.github/workflows/merge.yaml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
- name: "Request review from @ergebnis-bot"
28+
uses: "actions/[email protected]"
29+
with:
30+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
31+
script: |
32+
const pullRequest = context.payload.workflow_run.pull_requests[0]
33+
const repository = context.repo
34+
35+
const reviewers = [
36+
"ergebnis-bot",
37+
]
38+
39+
await github.pulls.requestReviewers({
40+
owner: repository.owner,
41+
repo: repository.repo,
42+
pull_number: pullRequest.number,
43+
reviewers: reviewers,
44+
})
45+
46+
- name: "Assign @ergebnis-bot"
47+
uses: "actions/[email protected]"
48+
with:
49+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
50+
script: |
51+
const pullRequest = context.payload.workflow_run.pull_requests[0]
52+
const repository = context.repo
53+
54+
const assignees = [
55+
"ergebnis-bot",
56+
]
57+
58+
await github.issues.addAssignees({
59+
owner: repository.owner,
60+
repo: repository.repo,
61+
assignees: assignees,
62+
issue_number: pullRequest.number
63+
})
64+
65+
- name: "Approve pull request"
66+
uses: "actions/[email protected]"
67+
with:
68+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
69+
script: |
70+
const pullRequest = context.payload.workflow_run.pull_requests[0]
71+
const repository = context.repo
72+
73+
await github.pulls.createReview({
74+
event: "APPROVE",
75+
owner: repository.owner,
76+
repo: repository.repo,
77+
pull_number: pullRequest.number,
78+
})
79+
80+
- name: "Merge pull request"
81+
uses: "actions/[email protected]"
82+
with:
83+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
84+
script: |
85+
const pullRequest = context.payload.workflow_run.pull_requests[0]
86+
const repository = context.repo
87+
88+
await github.pulls.merge({
89+
merge_method: "merge",
90+
owner: repository.owner,
91+
pull_number: pullRequest.number,
92+
repo: repository.repo,
93+
})

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# json-schema-validator
22

33
[![Integrate](https://github.com/ergebnis/json-schema-validator/workflows/Integrate/badge.svg)](https://github.com/ergebnis/json-schema-validator/actions)
4+
[![Merge](https://github.com/ergebnis/json-schema-validator/workflows/Merge/badge.svg)](https://github.com/ergebnis/json-schema-validator/actions)
45
[![Prune](https://github.com/ergebnis/json-schema-validator/workflows/Prune/badge.svg)](https://github.com/ergebnis/json-schema-validator/actions)
56
[![Release](https://github.com/ergebnis/json-schema-validator/workflows/Release/badge.svg)](https://github.com/ergebnis/json-schema-validator/actions)
67
[![Renew](https://github.com/ergebnis/json-schema-validator/workflows/Renew/badge.svg)](https://github.com/ergebnis/json-schema-validator/actions)

0 commit comments

Comments
 (0)