Skip to content

Commit 3bcc469

Browse files
authored
Make dependabot update monthly (#144)
- Update dependabot configuration to run monthly - Remove `time` from Dependabot config - Use a random day of the week for Dependabot updates - Update release notes
2 parents 330bb2d + 9b4380d commit 3bcc469

File tree

9 files changed

+61
-31
lines changed

9 files changed

+61
-31
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7-
time: "07:00"
7+
day: "monday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "monday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- CI
2424

2525
- You can now make your branch protection rule only require the "Test with nox" CI job to pass. All the matrix expansions will merge into it, so there is no need to change branch protection rules if matrix elements are added or removed.
26+
- Dependabot now will check for updates monthly and on a random day and time.
2627

2728
## New Features
2829

@@ -43,6 +44,7 @@
4344
- Add CI job to test package installation on multiple platforms (amd64 and arm64).
4445
- Add CI job to run the tests in arm64.
4546
- Add a CI job to *join* all `nox` runs, so only one branch protection rule needs to be used.
47+
- Dependabot now will check for updates monthly and on a random day and time. This is to avoid all repositories updating at the same time.
4648

4749
## Bug Fixes
4850

cookiecutter/local_extensions.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"""
99

1010
import json as _json
11+
import os as _os
1112
import pathlib as _pathlib
13+
import random as _random
1214

1315
from jinja2 import Environment as _Environment
1416
from jinja2.ext import Extension as _Extension
@@ -35,6 +37,11 @@ def __init__(self, environment: _Environment):
3537
"""
3638
super().__init__(environment)
3739
self._register_filters()
40+
self.environment.globals.update(
41+
{
42+
"random_weekday": self._get_random_weekday(),
43+
}
44+
)
3845

3946
def parse(self, parser: _Parser) -> _Node | list[_Node]:
4047
"""Parse tags declared by this extension.
@@ -95,6 +102,27 @@ def _get_from_json(self, key: str) -> str:
95102
with open("../cookiecutter.json", encoding="utf8") as cookiecutter_json_file:
96103
return str(_json.load(cookiecutter_json_file)[key])
97104

105+
def _get_random_weekday(self) -> str:
106+
"""Get a random weekday.
107+
108+
Returns:
109+
A random weekday.
110+
"""
111+
# Make sure tests are reproduceable
112+
if _os.environ.get("PYTEST_CURRENT_TEST") is not None:
113+
return "monday"
114+
return _random.choice(
115+
[
116+
"monday",
117+
"tuesday",
118+
"wednesday",
119+
"thursday",
120+
"friday",
121+
"saturday",
122+
"sunday",
123+
]
124+
)
125+
98126
def _as_identifier_filter(self, name: str) -> str:
99127
"""Convert a name to a valid identifier.
100128

cookiecutter/{{cookiecutter.github_repo_name}}/.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "{{ random_weekday }}"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "{{ random_weekday }}"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"
@@ -53,8 +53,8 @@ updates:
5353
ignore:
5454
- dependency-name: "submodules/frequenz-api-common"
5555
schedule:
56-
interval: "weekly"
57-
time: "06:00"
56+
interval: "monthly"
57+
day: "{{ random_weekday }}"
5858
labels:
5959
- "part:tooling"
6060
- "type:tech-debt"

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "monday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "monday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"

tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "monday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "monday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"
@@ -52,8 +52,8 @@ updates:
5252
ignore:
5353
- dependency-name: "submodules/frequenz-api-common"
5454
schedule:
55-
interval: "weekly"
56-
time: "06:00"
55+
interval: "monthly"
56+
day: "monday"
5757
labels:
5858
- "part:tooling"
5959
- "type:tech-debt"

tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "monday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "monday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"

tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "monday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "monday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"

tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "monday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "monday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"

0 commit comments

Comments
 (0)