AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix(ci): make changelog-guard workflow parseable again
Trevin Chow6bfc957e55c9
diff --git a/.github/scripts/read_manifest_version.py b/.github/scripts/read_manifest_version.pynew file mode 100644index 00000000..eaa1e7a5--- /dev/null+++ b/.github/scripts/read_manifest_version.py@@ -0,0 +1,53 @@+#!/usr/bin/env python3+"""Print the lockstep version string from a manifest file on stdin.++Used by .github/workflows/changelog-guard.yml so version parsing stays out of+the YAML ``run: |`` block (column-0 Python inside that block breaks Actions).++Usage:+ git show REF:path | python3 .github/scripts/read_manifest_version.py path+"""++from __future__ import annotations++import json+import re+import sys+++def version_from(path: str, text: str) -> str:+ if path.endswith("pyproject.toml"):+ match = re.search(r'(?m)^version\s*=\s*"([^"]+)"\s*$', text)+ return match.group(1) if match else ""+ if path.endswith("SKILL.md"):+ match = re.search(r'(?m)^version:\s*"([^"]+)"\s*$', text)+ return match.group(1) if match else ""+ if path.endswith("uv.lock"):+ match = re.search(+ r'(?ms)^\[\[package\]\]\nname = "last30days-skill"\nversion = "([^"]+)"',+ text,+ )+ return match.group(1) if match else ""+ if path.endswith("marketplace.json"):+ data = json.loads(text)+ plugins = data.get("plugins") or []+ return plugins[0].get("version", "") if plugins else ""+ data = json.loads(text)+ return data.get("version", "") or ""+++def main(argv: list[str]) -> int:+ if len(argv) != 2:+ print(+ "usage: read_manifest_version.py PATH < manifest",+ file=sys.stderr,+ )+ return 2+ path = argv[1]+ text = sys.stdin.read()+ sys.stdout.write(version_from(path, text))+ return 0+++if __name__ == "__main__":+ raise SystemExit(main(sys.argv))diff --git a/.github/workflows/changelog-guard.yml b/.github/workflows/changelog-guard.ymlindex 45dbf5a2..9b98500d 100644--- a/.github/workflows/changelog-guard.yml+++ b/.github/workflows/changelog-guard.yml@@ -76,33 +76,15 @@ jobs:exit 1fi+ # Keep version parsing in .github/scripts/ — a prior inline+ # python3 -c block used column-0 source and made Actions refuse+ # to parse this workflow (every run failed with empty jobs).version_at() {local ref="$1"local path="$2"- git show "${ref}:${path}" 2>/dev/null | PATH_ARG="${path}" python3 -c '-import json, os, re, sys-path = os.environ["PATH_ARG"]-text = sys.stdin.read()-if path.endswith("pyproject.toml"):- m = re.search(r"(?m)^version\s*=\s*\"([^\"]+)\"\s*$", text)- print(m.group(1) if m else "")-elif path.endswith("SKILL.md"):- m = re.search(r"(?m)^version:\s*\"([^\"]+)\"\s*$", text)- print(m.group(1) if m else "")-elif path.endswith("uv.lock"):- m = re.search(- r"(?ms)^\[\[package\]\]\nname = \"last30days-skill\"\nversion = \"([^\"]+)\"",- text,- )- print(m.group(1) if m else "")-elif path.endswith("marketplace.json"):- data = json.loads(text)- plugins = data.get("plugins") or []- print(plugins[0].get("version", "") if plugins else "")-else:- data = json.loads(text)- print(data.get("version", ""))-'+ git show "${ref}:${path}" 2>/dev/null \+ | python3 .github/scripts/read_manifest_version.py "${path}" \+ || true}VERSION_PATHS=(diff --git a/tests/test_changelog_workflow.py b/tests/test_changelog_workflow.pyindex 41c95720..a5e68243 100644--- a/tests/test_changelog_workflow.py+++ b/tests/test_changelog_workflow.py@@ -57,6 +57,67 @@ class TestChangelogWorkflow(unittest.TestCase):):self.assertTrue((workflows / name).is_file(), msg=name)+ def test_changelog_guard_run_blocks_stay_indented(self) -> None:+ """Column-0 lines inside ``run: |`` break Actions YAML parsing."""+ path = ROOT / ".github" / "workflows" / "changelog-guard.yml"+ lines = path.read_text(encoding="utf-8").splitlines()+ in_run = False+ run_indent = 0+ for lineno, line in enumerate(lines, 1):+ match = re.match(r"^(\s*)run:\s*\|\s*$", line)+ if match:+ in_run = True+ run_indent = len(match.group(1))+ continue+ if not in_run or not line.strip():+ continue+ indent = len(line) - len(line.lstrip(" "))+ if indent <= run_indent:+ in_run = False+ continue+ self.assertGreater(+ indent,+ run_indent,+ msg=f"{path}:{lineno} must stay indented inside run: |",+ )++ def test_read_manifest_version_helper(self) -> None:+ script = ROOT / ".github" / "scripts" / "read_manifest_version.py"+ self.assertTrue(script.is_file())+ spec = importlib.util.spec_from_file_location("read_manifest_version", script)+ assert spec and spec.loader+ mod = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(mod)+ self.assertEqual(+ mod.version_from("pyproject.toml", 'version = "3.18.1"\n'),+ "3.18.1",+ )+ self.assertEqual(+ mod.version_from("skills/last30days/SKILL.md", 'version: "3.18.1"\n'),+ "3.18.1",+ )+ self.assertEqual(+ mod.version_from(+ "uv.lock",+ '[[package]]\nname = "last30days-skill"\nversion = "3.18.1"\n',+ ),+ "3.18.1",+ )+ self.assertEqual(+ mod.version_from(+ ".claude-plugin/plugin.json",+ json.dumps({"version": "3.18.1"}),+ ),+ "3.18.1",+ )+ self.assertEqual(+ mod.version_from(+ ".claude-plugin/marketplace.json",+ json.dumps({"plugins": [{"version": "3.18.1"}]}),+ ),+ "3.18.1",+ )+def test_pr_template_has_agent_and_relationship_sections(self) -> None:text = (ROOT / ".github" / "PULL_REQUEST_TEMPLATE.md").read_text(encoding="utf-8"