Skip to content

Commit 7cb6d8b

Browse files
committed
Fix issue template: replace radio with dropdown input type
GitHub Issue forms don't support radio input type. Replace with dropdown and update audit script to extract ratings from template body field. Fixes template validation error and ensures ratings are properly parsed.
1 parent 91cdf0b commit 7cb6d8b

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

.github/ISSUE_TEMPLATE/analysis_review.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@ body:
1919
validations:
2020
required: true
2121

22-
- type: radio
22+
- type: dropdown
2323
id: rating
2424
attributes:
2525
label: Rating
2626
description: How would you rate the accuracy of this analysis?
2727
options:
28-
- label: Correct
29-
value: correct
30-
- label: Needs Review
31-
value: needs-review
32-
- label: Incorrect
33-
value: incorrect
28+
- Correct
29+
- Needs Review
30+
- Incorrect
3431
validations:
3532
required: true
3633

Scripts/audit_reviews.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,37 @@ def extract_rating_from_labels(labels: List[Any]) -> Optional[str]:
8181
return None
8282

8383

84+
def extract_rating_from_body(body: str) -> Optional[str]:
85+
"""Extract rating from issue body (template dropdown field)."""
86+
if not body:
87+
return None
88+
89+
# Try to find rating from template field (dropdown)
90+
rating_match = re.search(r'###\s*Rating\s*\n\s*([^\n]+)', body, re.IGNORECASE)
91+
if rating_match:
92+
rating = rating_match.group(1).strip()
93+
return normalize_rating(rating)
94+
95+
return None
96+
97+
98+
def normalize_rating(rating: str) -> str:
99+
"""Normalize rating value to standard format."""
100+
if not rating:
101+
return "needs-review"
102+
103+
rating_lower = rating.lower().strip()
104+
# Handle dropdown format values (with spaces, title case)
105+
if "correct" in rating_lower:
106+
return "correct"
107+
elif "incorrect" in rating_lower:
108+
return "incorrect"
109+
elif "needs review" in rating_lower or "needs-review" in rating_lower or "needs_review" in rating_lower:
110+
return "needs-review"
111+
else:
112+
return "needs-review" # Default
113+
114+
84115
def extract_comment_from_body(body: str) -> str:
85116
"""Extract comment text from issue body."""
86117
if not body:
@@ -162,9 +193,12 @@ def main() -> None:
162193
# Skip issues without a valid method
163194
continue
164195

165-
rating = extract_rating_from_labels(list(issue.labels))
196+
# Try to extract rating from body first (template field), then from labels
197+
rating = extract_rating_from_body(issue.body or "")
198+
if not rating:
199+
rating = extract_rating_from_labels(list(issue.labels))
166200
if not rating:
167-
rating = "needs-review" # Default if no rating label
201+
rating = "needs-review" # Default if no rating found
168202

169203
comment = extract_comment_from_body(issue.body or "")
170204

0 commit comments

Comments
 (0)