-
Notifications
You must be signed in to change notification settings - Fork 9
44 lines (38 loc) · 1.31 KB
/
dependabot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Auto Merge Dependabot PRs
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js (if your project uses Node.js)
uses: actions/setup-node@v3
with:
node-version: '16' # Or the version your project uses
- name: Install dependencies
run: npm install # Adapt this step to your project's dependency manager
- name: Run tests
run: npm test # Replace with your test command
- name: Merge Dependabot PR
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
if (pr.user.login === 'dependabot[bot]' && pr.state === 'open' && pr.mergeable) {
const merge = await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
});
console.log('PR merged:', merge.data.merged);
} else {
console.log('PR not merged. Conditions not met.');
}