From fa5817684b0e8abb7045b18c09d34972a744ccdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C4=B1lmaz=20Alpaslan?= Date: Fri, 24 Jul 2026 02:59:14 +0300 Subject: [PATCH] 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 --- .github/workflows/update-catalog.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/update-catalog.py b/.github/workflows/update-catalog.py index f81be4e..deb2117 100644 --- a/.github/workflows/update-catalog.py +++ b/.github/workflows/update-catalog.py @@ -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'])}", ] )