feat(workflow): add last_modified and date_added fields in catalog.toml (#80)

* Add last_modified and date_added fields in catalog.toml

* remove changes to catalog.toml, better field naming

---------

Co-authored-by: Lemmy <studio@quadbyte.net>
This commit is contained in:
Yılmaz Alpaslan
2026-07-23 19:59:14 -04:00
committed by GitHub
co-authored by Lemmy
parent cf4074872e
commit fa5817684b
+18
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
import re
import subprocess
import sys
import tomllib
from pathlib import Path
@@ -46,6 +47,21 @@ def load_plugin_manifest(path: Path) -> dict:
if not isinstance(manifest[field], bool):
raise ValueError(f"{path.relative_to(ROOT_DIR)} has invalid {field}; expected bool")
out[field] = manifest[field]
out["updated_at"] = int(subprocess.run(
["git", "log", "-1", "--format=%ct", "--", path],
capture_output=True,
text=True,
check=True,
).stdout.strip())
out["added_at"] = int(subprocess.run(
["git", "log", "-1", "--diff-filter=A", "--format=%ct", "--", path],
capture_output=True,
text=True,
check=True
).stdout.strip())
return out
@@ -102,6 +118,8 @@ def render_catalog(plugins: list[dict]) -> str:
f"id = {toml_string(plugin['id'])}",
f"name = {toml_string(plugin['name'])}",
f"version = {toml_string(plugin['version'])}",
f"updated_at = {plugin['updated_at']}",
f"added_at = {plugin['added_at']}",
f"author = {toml_string(plugin['author'])}",
]
)