Skip to content

Commit

Permalink
Migrate ISSUE_TEMPLATE to new issue templates format
Browse files Browse the repository at this point in the history
Also update gh-data.py to support the new issue format.
  • Loading branch information
keithamus authored Feb 12, 2025
1 parent 45d92db commit d94a0e6
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 28 deletions.
58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/request-for-position.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Request for Mozilla Position on an Emerging Web Specification
description: If you're working on a spec and would like to know Mozilla's position on it.
body:
- type: input
id: spec-title
attributes:
label: "Specification title"
description: "Please also use the specification title as the issue title."
validations:
required: true
- type: input
id: spec-url
attributes:
label: "Specification or proposal URL (if available)"
placeholder: "https://"
- type: input
id: spec-explainer
attributes:
label: "Explainer URL (if available)"
placeholder: "https://"
- type: input
id: spec-authors
attributes:
label: "Proposal author(s)"
placeholder: "@handle"
- type: input
id: mdn-url
attributes:
label: "MDN URL"
placeholder: "https://"
- type: input
id: caniuse-url
attributes:
label: "Caniuse.com URL"
placeholder: "https://"
- type: input
id: bugzilla-url
attributes:
label: "Bugzilla URL"
placeholder: "https://bugzilla.mozilla.org/show_bug.cgi?id=NNNNNNN"
- type: input
id: mozillians
attributes:
label: "Mozillians who can provide input"
placeholder: "@zcorpan @emilio"
- type: input
id: webkit-standards-position
attributes:
label: "WebKit standards-position"
placeholder: "https://github.com/WebKit/standards-positions/issues/NNN"
- type: textarea
id: other
attributes:
label: "Other information"
placeholder: |
Other information you think will aid us in coming to a position.
16 changes: 0 additions & 16 deletions ISSUE_TEMPLATE.md

This file was deleted.

58 changes: 46 additions & 12 deletions gh-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def process_body(issue):
"webkit": None,
}

mapping = {
legacy_mapping = {
# "specification title": "title", # Always use the issue title
"specification or proposal url (if available)": "url",
"specification or proposal url": "url",
Expand All @@ -103,20 +103,54 @@ def process_body(issue):
"webkit standards-position": "webkit",
}

yaml_mapping = {
# Specification title
"Specification or proposal URL (if available)": "url",
"Explainer URL (if available)": "explainer",
"MDN URL": "mdn",
"Caniuse.com URL": "caniuse",
"Bugzilla URL": "bug",
"WebKit standards-position": "webkit",
}

for line in lines:
if line == "### Other information":
break
for title, key in mapping.items():
text_title = f"* {title}: "
if line.lower().startswith(text_title):
value = line[len(text_title) :].strip()
value = re.sub(r"\[[^\]]+\]\(([^\)]+)\)", r"\1", value)
# Legacy issues using ISSUE_TEMPLATE.md
if issue["number"] < 1175:
for line in lines:
if line == "### Other information":
break
for title, key in legacy_mapping.items():
text_title = f"* {title}: "
if line.lower().startswith(text_title):
value = line[len(text_title) :].strip()
if key in ("url", "explainer", "mdn", "caniuse", "bug", "webkit"):
value = get_url(value)
if value != "" and value.lower() != "n/a":
body[key] = value
break
# Issues using YAML template
else:
expect_response = None
skip = False
for line in lines:
if line == "### Other information":
break
for title, key in yaml_mapping.items():
text_title = f"### {title}"
if line == text_title:
expect_response = key
skip = True
break
if skip:
skip = False
continue
if expect_response:
value = line.strip()
if key in ("url", "explainer", "mdn", "caniuse", "bug", "webkit"):
value = get_url(value)
if value != "" and value.lower() != "n/a":
body[key] = value
break
if value and value != "_No response_" and value.lower() != "n/a":
body[expect_response] = value
expect_response = None

return body


Expand Down

0 comments on commit d94a0e6

Please sign in to comment.