Skip to content

Commit 2cdbf8a

Browse files
Merge pull request #127 from NHSDigital/APM-7113
Added dependabot automation
2 parents 706c853 + 5e6ae95 commit 2cdbf8a

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: 2
2+
updates:
3+
4+
# ---------------------------
5+
# Python (Poetry via pip)
6+
# ---------------------------
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
target-branch: "master"
12+
labels: ["dependencies", "python", "poetry"]
13+
open-pull-requests-limit: 10
14+
ignore:
15+
- dependency-name: "*"
16+
update-types: ["version-update:semver-major"]
17+
18+
# ---------------------------
19+
# NodeJS (root)
20+
# ---------------------------
21+
- package-ecosystem: "npm"
22+
directory: "/"
23+
schedule:
24+
interval: "daily"
25+
target-branch: "master"
26+
labels: ["dependencies", "npm"]
27+
open-pull-requests-limit: 10
28+
ignore:
29+
- dependency-name: "*"
30+
update-types: ["version-update:semver-major"]
31+
32+
# ---------------------------
33+
# Docker (Dockerfile updates)
34+
# ---------------------------
35+
- package-ecosystem: "docker"
36+
directory: "/docker"
37+
schedule:
38+
interval: "daily"
39+
target-branch: "master"
40+
labels: ["dependencies", "docker"]
41+
open-pull-requests-limit: 10
42+
43+
# ---------------------------
44+
# GitHub Actions
45+
# ---------------------------
46+
- package-ecosystem: "github-actions"
47+
directory: "/"
48+
schedule:
49+
interval: "daily"
50+
target-branch: "master"
51+
labels: ["dependencies", "github-actions"]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Dependabot auto-merge
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, synchronize, ready_for_review]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
automerge:
13+
name: Auto-merge Dependabot patch updates
14+
runs-on: ubuntu-latest
15+
16+
# Only run on Dependabot PRs
17+
if: github.event.pull_request.user.login == 'dependabot[bot]'
18+
19+
steps:
20+
- name: Fetch Dependabot metadata
21+
id: meta
22+
uses: dependabot/fetch-metadata@v2
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Approve PR
27+
run: gh pr review --approve "$PR_URL"
28+
env:
29+
PR_URL: ${{ github.event.pull_request.html_url }}
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Auto-merge patch updates only
33+
if: steps.meta.outputs.update-type == 'version-update:semver-patch'
34+
run: gh pr merge --auto --squash "$PR_URL"
35+
env:
36+
PR_URL: ${{ github.event.pull_request.html_url }}
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)