-
Notifications
You must be signed in to change notification settings - Fork 0
202 lines (183 loc) · 6.21 KB
/
create-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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Create Dependabot Config
on:
push:
paths:
- '.github/workflows/create-dependabot.yml'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
create-dependabot:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate expected hash
id: hash
run: |
EXPECTED_CONTENT='# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# NuGet dependencies
- package-ecosystem: "nuget"
directory: "**/*"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 1
groups:
patch-and-minor:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "nuget"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
# npm dependencies
- package-ecosystem: "npm"
directory: "**/*"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 1
groups:
patch-and-minor:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "npm"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
# Docker dependencies
- package-ecosystem: "docker"
directory: "**/*"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 1
groups:
patch-and-minor:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "docker"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "**/*"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 1
groups:
patch-and-minor:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "github-actions"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
# Python (pip) dependencies
- package-ecosystem: "pip"
directory: "**/*"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 1
groups:
patch-and-minor:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "pip"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
# Terraform dependencies
- package-ecosystem: "terraform"
directory: "**/*"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/London"
open-pull-requests-limit: 1
groups:
patch-and-minor:
patterns:
- "*"
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "terraform"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]'
echo "EXPECTED_CONTENT<<EOF" >> $GITHUB_ENV
echo "$EXPECTED_CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
EXPECTED_HASH=$(echo "$EXPECTED_CONTENT" | sha256sum | cut -d' ' -f1)
echo "expected=$EXPECTED_HASH" >> $GITHUB_OUTPUT
if [ -f ".github/dependabot.yml" ]; then
CURRENT_HASH=$(cat .github/dependabot.yml | sha256sum | cut -d' ' -f1)
echo "current=$CURRENT_HASH" >> $GITHUB_OUTPUT
else
echo "current=none" >> $GITHUB_OUTPUT
fi
- name: Create or update dependabot.yml
id: create-dependabot
if: steps.hash.outputs.current != steps.hash.outputs.expected
run: |
# Create a new branch
BRANCH_NAME="feature/update-dependabot-config-$(date +%s)"
git checkout -b $BRANCH_NAME
mkdir -p .github
echo "$EXPECTED_CONTENT" > .github/dependabot.yml
git config --global user.email "[email protected]"
git config --global user.name "Joe"
# Stage and commit the changes
git add .github/dependabot.yml
git commit -m "Add or update dependabot.yml configuration"
# Push the branch
git push origin $BRANCH_NAME
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT