Skip to content

Commit 279c10f

Browse files
committed
Add initial date
1 parent e06d9b8 commit 279c10f

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

root/app/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pydantic import BaseModel
22

33
# Increment when updating schema or forcing an update on start
4-
IMAGES_SCHEMA_VERSION = 2
4+
IMAGES_SCHEMA_VERSION = 3
55

66

77
class Tag(BaseModel):
@@ -92,6 +92,7 @@ class Config(BaseModel):
9292

9393
class Image(BaseModel):
9494
name: str
95+
initial_date: str
9596
github_url: str
9697
project_url: str | None = None
9798
project_logo: str | None = None

root/app/updater.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ def get_architectures(readme_vars):
3131
archs.append(Architecture(arch=item["arch"], tag=item["tag"]))
3232
return archs
3333

34-
def get_changelogs(readme_vars):
34+
def get_changelog(readme_vars):
3535
if "changelogs" not in readme_vars:
3636
return None
37-
changelogs = []
37+
changelog = []
3838
for item in readme_vars["changelogs"][0:3]:
39-
changelogs.append(Changelog(date=item["date"][0:-1], desc=item["desc"]))
40-
return changelogs
39+
changelog.append(Changelog(date=item["date"][0:-1], desc=item["desc"]))
40+
first_changelog = readme_vars["changelogs"][-1]
41+
initial_date = first_changelog["date"][0:-1]
42+
return changelog, initial_date
4143

4244
def get_description(readme_vars):
4345
description = readme_vars.get("project_blurb", "No description")
@@ -153,6 +155,7 @@ def get_image(repo):
153155
application_setup = None
154156
if readme_vars.get("app_setup_block_enabled", False):
155157
application_setup = f"{repo.html_url}?tab=readme-ov-file#application-setup"
158+
changelog, initial_date = get_changelog(readme_vars)
156159
config = Config(
157160
application_setup=application_setup,
158161
readonly_supported=readme_vars.get("readonly_supported", None),
@@ -171,6 +174,7 @@ def get_image(repo):
171174
)
172175
return Image(
173176
name=project_name,
177+
initial_date=initial_date,
174178
github_url=repo.html_url,
175179
stars=repo.stargazers_count,
176180
project_url=readme_vars.get("project_url", None),
@@ -183,7 +187,7 @@ def get_image(repo):
183187
deprecated=deprecated,
184188
tags=tags,
185189
architectures=get_architectures(readme_vars),
186-
changelog=get_changelogs(readme_vars),
190+
changelog=changelog,
187191
config=config,
188192
)
189193

0 commit comments

Comments
 (0)