-
Notifications
You must be signed in to change notification settings - Fork 4
51 lines (47 loc) · 1.8 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
45
46
47
48
49
50
51
name: Dependabot auto-merge
on: pull_request_target
jobs:
waiter:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
timeout-minutes: 15
steps:
- uses: actions/github-script@v6
with:
script: |
const wait = (ms) => new Promise(resolve => setTimeout(() => resolve('done'), ms));
let workflowPending = true;
while (workflowPending) {
await wait(10000);
let { data: { check_runs } } = await github.rest.checks.listForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: '${{ github.event.pull_request.head.ref }}'
});
console.log(check_runs);
if (check_runs.length === 0) {
continue;
}
workflowPending = !check_runs
.filter(({ name }) => !['waiter', 'dependabot'].includes(name) )
.every(({ conclusion, status }) => status === 'completed' && ['success', 'skipped'].includes(conclusion));
}
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
needs: [waiter]
permissions:
pull-requests: write
contents: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}