Skip to content

Commit 461196a

Browse files
author
internet-dot
committed
Address review feedback on plugins.json
- Move import datetime to top-level imports (PEP 8) - Fix end-is-None false negative when Community Plugins is last section - Add TODO for install_url default branch assumption - Add generator script to CI paths trigger
1 parent 8e69a17 commit 461196a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/validate-plugins.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
paths:
66
- README.md
77
- plugins.json
8+
- scripts/generate_plugins_json.py
89
push:
910
branches: [main]
1011
paths:
1112
- README.md
1213
- plugins.json
14+
- scripts/generate_plugins_json.py
1315

1416
jobs:
1517
validate:

scripts/generate_plugins_json.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
This should be run after any change to the plugin list in README.md.
88
"""
9+
import datetime
910
import json
1011
import re
1112
from pathlib import Path
@@ -26,7 +27,9 @@ def parse_plugins(readme_path: Path) -> list[dict]:
2627
end = i
2728
break
2829

29-
if start is None or end is None:
30+
if end is None:
31+
end = len(lines)
32+
if start is None:
3033
raise ValueError("Could not find Community Plugins section")
3134

3235
section = lines[start:end]
@@ -50,6 +53,7 @@ def parse_plugins(readme_path: Path) -> list[dict]:
5053
if key in seen:
5154
continue
5255
seen.add(key)
56+
# TODO: Detect default branch via GitHub API; some repos use 'master' or other names
5357
plugins.append(
5458
{
5559
"name": m.group(1),
@@ -67,8 +71,6 @@ def parse_plugins(readme_path: Path) -> list[dict]:
6771

6872

6973
def main():
70-
import datetime
71-
7274
plugins = parse_plugins(README)
7375
data = {
7476
"$schema": "https://json-schema.org/draft/2020-12/schema",

0 commit comments

Comments
 (0)