Skip to content

Commit 0fa66b1

Browse files
committed
debug: log issue fetching in main.go
1 parent d121ca2 commit 0fa66b1

2 files changed

Lines changed: 41 additions & 32 deletions

File tree

cmd/iterate/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func main() {
110110
community.IssueTypeSelf,
111111
community.IssueTypeHelpWanted,
112112
}
113+
logger.Info("fetching issues", "owner", *ghOwner, "repo", *ghRepo)
113114
rawIssues, err = community.FetchIssues(fetchCtx, *ghOwner, *ghRepo, issueTypes, *issueMax)
114115
cancel()
115116
if err != nil {
@@ -120,7 +121,10 @@ func main() {
120121
for _, v := range rawIssues {
121122
total += len(v)
122123
}
123-
logger.Info("loaded community issues", "count", total)
124+
logger.Info("loaded community issues", "count", total, "issues_len", len(issues))
125+
if len(issues) == 0 {
126+
logger.Warn("issues string is empty despite fetching some")
127+
}
124128
}
125129
}
126130

scripts/format_issues.py

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
import sys
77
from datetime import datetime
88

9+
910
def run_gh_command(cmd):
1011
"""Run a gh CLI command and return JSON output."""
1112
try:
1213
result = subprocess.run(
13-
cmd,
14-
shell=True,
15-
capture_output=True,
16-
text=True,
17-
timeout=30
14+
cmd, shell=True, capture_output=True, text=True, timeout=30
1815
)
1916
if result.returncode == 0 and result.stdout:
2017
return json.loads(result.stdout)
@@ -23,59 +20,67 @@ def run_gh_command(cmd):
2320
print(f"Error running command: {e}", file=sys.stderr)
2421
return None
2522

23+
2624
def fetch_issues():
2725
"""Fetch open issues from GitHub."""
28-
cmd = 'gh issue list --json number,title,body,labels,reactions --limit 20'
26+
cmd = "gh issue list --json number,title,body,labels --limit 20"
2927
data = run_gh_command(cmd)
30-
28+
3129
if not data:
3230
return []
33-
31+
3432
# Parse and filter by labels
3533
issues = []
3634
for item in data:
37-
labels = [l.get('name', '') for l in item.get('labels', [])]
38-
35+
labels = [l.get("name", "") for l in item.get("labels", [])]
36+
3937
# Prioritize agent-input and agent-help-wanted
4038
priority = 0
41-
if 'agent-input' in labels:
39+
if "agent-input" in labels:
4240
priority = 10
43-
elif 'agent-help-wanted' in labels:
41+
elif "agent-help-wanted" in labels:
4442
priority = 5
45-
elif 'agent-self' in labels:
43+
elif "agent-self" in labels:
4644
priority = 1
47-
45+
4846
if priority > 0:
49-
issues.append({
50-
'number': item['number'],
51-
'title': item['title'],
52-
'body': item['body'] or '',
53-
'priority': priority,
54-
'labels': labels
55-
})
56-
47+
issues.append(
48+
{
49+
"number": item["number"],
50+
"title": item["title"],
51+
"body": item["body"] or "",
52+
"priority": priority,
53+
"labels": labels,
54+
}
55+
)
56+
5757
# Sort by priority (descending) then by number (descending)
58-
issues.sort(key=lambda x: (-x['priority'], -x['number']))
59-
58+
issues.sort(key=lambda x: (-x["priority"], -x["number"]))
59+
6060
return issues[:10] # Top 10 issues
6161

62+
6263
def main():
6364
"""Generate ISSUES_TODAY.md from GitHub issues."""
6465
issues = fetch_issues()
65-
66+
6667
if not issues:
67-
print("# Issues Today\n\nNo open issues labeled with agent-input or agent-help-wanted.", file=sys.stdout)
68+
print(
69+
"# Issues Today\n\nNo open issues labeled with agent-input or agent-help-wanted.",
70+
file=sys.stdout,
71+
)
6872
return
69-
73+
7074
output = ["# Issues Today\n"]
71-
75+
7276
for issue in issues:
7377
output.append(f"## Issue #{issue['number']}: {issue['title']}\n")
7478
output.append(f"Labels: {', '.join(issue['labels'])}\n\n")
7579
output.append(f"{issue['body']}\n\n")
7680
output.append("---\n\n")
77-
78-
print(''.join(output), file=sys.stdout)
7981

80-
if __name__ == '__main__':
82+
print("".join(output), file=sys.stdout)
83+
84+
85+
if __name__ == "__main__":
8186
main()

0 commit comments

Comments
 (0)