Files
a0-plugins/scripts/generate_post_commit.py
T
frdel 260a3fff28 Refactor index generation and workflows
Move and consolidate index/discussion generation into a new scripts/generate_index.py and make ensure_plugin_discussions.py a lightweight compatibility shim that delegates to it. Add a discussion template (scripts/plugin_discussion_template.md) and a manual Refresh Plugin Discussions workflow (.github/workflows/refresh-plugin-discussions.yml) that can regenerate/publish the index. Improve reliability of scripts/download_index_release.py by adding retry/backoff behavior. Update CI workflow steps (.github/workflows/generate-all.yml, generate-post-commit.yml, update-index-stars-hourly.yml) to download the tagged index release (best-effort) and rename generation step labels for clarity. Update scripts/generate_post_commit.py to call the consolidated generator (task name "index", but still accepting "discussions" for compatibility). Add .gitignore for __pycache__ and simplify update_index_stars.py by removing an inline GraphQL helper. These changes centralize index generation, add a reusable discussion template, and make release downloads/workflows more robust.
2026-03-05 09:56:00 +01:00

48 lines
1.2 KiB
Python

import argparse
import os
import sys
from pathlib import Path
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--all", action="store_true")
parser.add_argument("--max-plugins", type=int, default=None)
parser.add_argument(
"--tasks",
default="",
help="Comma-separated tasks to run. If omitted, runs all registered tasks.",
)
args = parser.parse_args()
repo_root = Path(__file__).resolve().parents[1]
scripts_dir = repo_root / "scripts"
sys.path.insert(0, str(scripts_dir))
sys.path.insert(0, str(repo_root))
if args.all:
os.environ["RUN_ALL"] = "1"
if args.max_plugins is not None:
os.environ["MAX_PLUGINS"] = str(args.max_plugins)
registered_tasks = ["index"]
tasks = [t.strip() for t in args.tasks.split(",") if t.strip()]
if not tasks:
tasks = registered_tasks
exit_code = 0
for task in tasks:
if task in {"index", "discussions"}:
import generate_index
exit_code = max(exit_code, int(generate_index.main()))
continue
raise SystemExit(f"Unknown task: {task}")
return exit_code
if __name__ == "__main__":
raise SystemExit(main())