Skip to content

Commit 47ec74e

Browse files
committed
render core and emeritus members via script
1 parent 4a69323 commit 47ec74e

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.ci_scripts/render_templated_content.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import csv
12
import re
2-
import requests
3-
import sys
43
import tarfile
54
from dataclasses import dataclass
65
from pathlib import Path
76
from tempfile import TemporaryDirectory
87

8+
import requests
9+
10+
911
REPO_URL = "https://github.com/conda-forge/cfep"
1012
REPO_ARCHIVE = "https://github.com/conda-forge/cfep/archive/main.tar.gz"
1113
REPO_CONTENTS = "https://api.github.com/repos/conda-forge/cfep/contents/"
@@ -14,6 +16,10 @@
1416
REPO_DIR = Path(__file__).parents[1].absolute()
1517
CFEP_INDEX_MD_TMPL = REPO_DIR / "docs" / "orga" / "cfep-index.md.tmpl"
1618
CFEP_INDEX_MD = REPO_DIR / "docs" / "orga" / "cfep-index.md"
19+
GOVERNANCE_MD_TMPL = REPO_DIR / "docs" / "orga" / "governance.md.tmpl"
20+
GOVERNANCE_MD = REPO_DIR / "docs" / "orga" / "governance.md"
21+
CORE_CSV = REPO_DIR / "src" / "core.csv"
22+
EMERITUS_CSV = REPO_DIR / "src" / "emeritus.csv"
1723

1824

1925
@dataclass
@@ -103,5 +109,30 @@ def write_cfep_index():
103109
CFEP_INDEX_MD.write_text(contents)
104110

105111

112+
def _get_formatted_names(path_file):
113+
with open(path_file, "r") as csv_file:
114+
dict_csv = csv.DictReader(csv_file)
115+
sorted_csv = sorted(dict_csv, key=lambda d: d["name"])
116+
return "\n".join(
117+
f"- [{m['name']} @{m['github_username']}]"
118+
f"(https://github.com/{m['github_username']}>)"
119+
for m in sorted_csv
120+
)
121+
122+
123+
def write_core_members():
124+
contents = GOVERNANCE_MD_TMPL.read_text()
125+
contents = contents.replace(
126+
"{{ core_members }}",
127+
_get_formatted_names(CORE_CSV)
128+
)
129+
contents = contents.replace(
130+
"{{ emeritus_members }}",
131+
_get_formatted_names(EMERITUS_CSV)
132+
)
133+
GOVERNANCE_MD.write_text(contents)
134+
135+
106136
if __name__ == "__main__":
107137
write_cfep_index()
138+
write_core_members()

.ci_scripts/update_docs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if [[ "$CI" == "1" ]]; then
1212
git checkout -b new_site_content
1313
fi
1414

15-
python "$BASE_DIR/.ci_scripts/generate_cfep_index.py"
15+
python "$BASE_DIR/.ci_scripts/render_templated_content.py"
1616

1717
# - Core and emeritus teams
1818

0 commit comments

Comments
 (0)