Skip to content

Commit 85cbd29

Browse files
Always normalize host/user and strip .html
Enforce consistent normalization when converting submission issues to CSV. scripts/issue_to_cookbook_csv.py: update docstring and logic to always derive `host` from landingpage_url, always set `user` to the GitHub repo owner (when repo_url is provided), and strip a trailing `.html` from landingpage values. .github/workflows/submission-issue-to-csv.yml: add note to the workflow description documenting the host/user normalization. d These changes make generated gallery records predictable and correct user/host values regardless of input.
1 parent c4ce7b8 commit 85cbd29

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎.github/workflows/submission-issue-to-csv.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,7 @@ jobs:
7070
Updates `doc/cookbook_gallery.csv` from submission issue #${{ github.event.issue.number }}.
7171
7272
Source: ${{ github.event.issue.html_url }}
73+
74+
Note: The automation normalizes `host` from `landingpage_url` and sets `user` to the GitHub repo owner.
7375
branch: "codex/submission-issue-${{ github.event.issue.number }}"
7476
delete-branch: true

‎scripts/issue_to_cookbook_csv.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ def parse_issue_fields(body: str) -> dict:
5656
- Gallery submission template labels (human-friendly text)
5757
5858
Human-error corrections applied later in main():
59-
- If landingpage_url doesn't contain host, rewrite host to the landing page base.
60-
- If user doesn't match the GitHub repo owner from repo_url, overwrite user with repo owner.
59+
- Always rewrite host to the landing page base (scheme + domain).
60+
- Always rewrite user to the GitHub repo owner from repo_url (when github.com).
61+
- If landingpage ends with .html, strip the suffix.
6162
"""
6263
template_key_map = {
6364
"name of the repository": "repo_name",
@@ -146,16 +147,18 @@ def main() -> None:
146147
fields = parse_issue_fields(body)
147148

148149
landingpage_url = fields.get("landingpage_url", "").strip()
149-
host = fields.get("host", "").strip()
150-
if landingpage_url and host and host not in landingpage_url:
150+
if landingpage_url:
151151
fields["host"] = derive_host_from_landingpage(landingpage_url)
152152

153153
repo_url = fields.get("repo_url", "").strip()
154-
user = fields.get("user", "").strip()
155154
repo_owner = derive_github_owner(repo_url) if repo_url else None
156-
if repo_owner and user and user != repo_owner:
155+
if repo_owner:
157156
fields["user"] = repo_owner
158157

158+
landingpage = fields.get("landingpage", "").strip()
159+
if landingpage.endswith(".html"):
160+
fields["landingpage"] = landingpage[: -len(".html")]
161+
159162
missing = validate_fields(fields)
160163
if missing:
161164
missing_list = ", ".join(missing)

0 commit comments

Comments
 (0)