Skip to content

Commit e920119

Browse files
committed
Update to Dependabot v2
1 parent 186e4f8 commit e920119

File tree

3 files changed

+58
-16
lines changed

3 files changed

+58
-16
lines changed

.dependabot/config.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 1000000
8+
- package-ecosystem: bundler
9+
directory: "/docs"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 1000000

.github/workflows/automerge.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Enable auto-merge for Dependabot PRs
14+
env:
15+
PR_URL: ${{github.event.pull_request.html_url}}
16+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
17+
run: |
18+
function get_pending_jobs() {
19+
gh pr view "$PR_URL" --json statusCheckRollup --jq '.statusCheckRollup | map(select(.name != "dependabot")) | map(select(.status != "COMPLETED")).[]'
20+
}
21+
22+
function get_failed_jobs() {
23+
gh pr view "$PR_URL" --json statusCheckRollup --jq '.statusCheckRollup | map(select(.name != "dependabot")) | map(select(.conclusion != "SUCCESS")).[]'
24+
}
25+
26+
function wait_until_completed() {
27+
while [[ $(get_pending_jobs) ]]
28+
do
29+
sleep 5
30+
done
31+
}
32+
33+
function fail_if_unsuccessful() {
34+
if [[ $(get_failed_jobs) ]]; then
35+
echo "Some jobs failed, unable to automerge"
36+
exit 1
37+
fi
38+
}
39+
40+
function auto_merge() {
41+
gh pr merge --auto --rebase "$PR_URL"
42+
}
43+
44+
wait_until_completed && \
45+
fail_if_unsuccessful && \
46+
auto_merge

0 commit comments

Comments
 (0)