Skip to content

Commit 47e5da6

Browse files
committed
ci: priority labels
1 parent d62ffb4 commit 47e5da6

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/scripts/triage_issue.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def get_gemini_response(api_key, prompt):
3535

3636
def main():
3737
api_key = os.getenv("GEMINI_API_KEY")
38-
print(f"DEBUG: Using API Key: {api_key}", file=sys.stderr)
3938
issue_title = os.getenv("ISSUE_TITLE")
4039
issue_body = os.getenv("ISSUE_BODY")
4140

@@ -49,7 +48,7 @@ def main():
4948

5049
prompt = f"""
5150
You are an expert software engineer and triage assistant.
52-
Analyze the following GitHub Issue details and suggest appropriate labels and a brief reasoning.
51+
Analyze the following GitHub Issue details and suggest appropriate labels.
5352
5453
Issue Title: {issue_title}
5554
Issue Description: {issue_body}
@@ -62,12 +61,9 @@ def main():
6261
- priority: p3: Minor enhancements or non-critical fixes.
6362
- priority: p4: Low priority, nice-to-have eventually.
6463
65-
Return a JSON object with two keys:
66-
1. "labels": an array of suggested label names.
67-
2. "reasoning": a brief, one-sentence explanation for your choice of labels, particularly the priority.
68-
64+
Return a JSON object with a 'labels' key containing an array of suggested label names.
6965
The response MUST be valid JSON.
70-
Example: {{"labels": ["priority: p0", "type: bug"], "reasoning": "The issue describes a fatal exception and includes a stack trace, indicating a critical crash that should be addressed immediately."}}
66+
Example: {{"labels": ["priority: p2", "type: bug"]}}
7167
"""
7268

7369
response_text = get_gemini_response(api_key, prompt)
@@ -77,9 +73,10 @@ def main():
7773
if response_text.startswith("```json"):
7874
response_text = response_text.replace("```json", "", 1).replace("```", "", 1).strip()
7975

80-
# Validate that the response is valid JSON before printing
81-
json.loads(response_text)
82-
print(response_text)
76+
result = json.loads(response_text)
77+
labels = result.get("labels", [])
78+
# Print labels as a comma-separated string for GitHub Actions
79+
print(",".join(labels))
8380
except Exception as e:
8481
print(f"Error parsing Gemini response: {e}", file=sys.stderr)
8582
print(f"Raw response: {response_text}", file=sys.stderr)

0 commit comments

Comments
 (0)