Skip to content

Commit 7d3d38e

Browse files
committed
Add schedule to cookiecutter updates
1 parent 343d8ad commit 7d3d38e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.github/workflows/cookiecutter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
name: "Update CI from cookiecutter"
33
on:
44
workflow_dispatch:
5+
schedule:
6+
- cron: "30 0 * * 0"
57

68
defaults:
79
run:

cookiecutter/ci/{{ cookiecutter.__project_name }}/.github/workflows/cookiecutter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
name: "Update CI from cookiecutter"
33
on:
44
workflow_dispatch:
5+
schedule:
6+
- cron: "30 {{ cookiecutter.app_label | hour }} * * 0"
57

68
defaults:
79
run:

cookiecutter/pulp_filter_extension.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ def to_snake(name: str) -> str:
9090
return name.replace("-", "_")
9191

9292

93+
def to_hour(name: str) -> int:
94+
"""
95+
Turn a string into a pseudorandom integer between 0 and 24.
96+
"""
97+
return sum((i * ord(c) for i, c in enumerate(name))) % 24
98+
99+
93100
class PulpFilterExtension(Extension):
94101
def __init__(self, environment: Environment):
95102
super().__init__(environment)
@@ -100,6 +107,7 @@ def __init__(self, environment: Environment):
100107
environment.filters["jaml"] = to_jaml
101108
environment.filters["toml_value"] = to_toml_value
102109
environment.filters["shquote"] = shlex.quote
110+
environment.filters["hour"] = to_hour
103111

104112

105113
try:

0 commit comments

Comments
 (0)