-
Notifications
You must be signed in to change notification settings - Fork 408
Expand file tree
/
Copy pathfetch_issues.py
More file actions
40 lines (31 loc) · 1.46 KB
/
fetch_issues.py
File metadata and controls
40 lines (31 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import urllib.request, json
from datetime import datetime, timezone, timedelta
req = urllib.request.Request("https://api.github.com/repos/devspace-sh/devspace/issues?state=open&sort=created&direction=desc&per_page=40")
req.add_header('User-Agent', 'python-urllib')
try:
with urllib.request.urlopen(req) as response:
data = json.loads(response.read().decode())
three_months_ago = datetime.now(timezone.utc) - timedelta(days=90)
print("===== RECENT OPEN ISSUES (NO PRS, UNASSIGNED) =====")
count = 0
for issue in data:
# Skip if PR
if "pull_request" in issue:
continue
# Skip if assigned
if issue.get("assignees"):
continue
# Check date
created_at = datetime.strptime(issue['created_at'], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
if created_at < three_months_ago:
continue
print(f"\n[{issue['number']}] {issue['title']} (Created: {issue['created_at'].split('T')[0]})")
print(f"URL: {issue['html_url']}")
# Print first 200 chars of body
body_preview = (issue['body'] or "")[:200].replace('\n', ' ').replace('\r', '')
print(f"Excerpt: {body_preview}...")
count += 1
if count >= 10:
break
except Exception as e:
print(e)