Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
nag least recently updated issue for this release
#!/usr/bin/python
import json
import pytz
import urllib2
import datetime
import dateutil.parser
import re
import sys
import humanize
PRINCESS_TOKEN = 'XXXX'
# {'name': 'www', 'milestone': 34, 'token': PRINCESS_TOKEN}
# {'name': 'partner', 'milestone': 4, 'token': PRINCESS_TOKEN},
# {'name': 'mobile-android', 'milestone': 17, 'token': PRINCESS_TOKEN},
# {'name': 'ipad', 'milestone': 5, 'token': PRINCESS_TOKEN},
# {'name': 'roku', 'milestone': 1, 'token': PRINCESS_TOKEN},
# {'name': 'mobile-iphone', 'milestone': 10, 'token': PRINCESS_TOKEN},
REPO_NAME = 'www'
MILESTONE = 36
URL_BASE = "https://api.github.com/repos/DramaFever/{name}/issues?access_token={token}&sort=updated&direction=asc&milestone={milestone}"
url = URL_BASE.format(name=REPO_NAME, token=PRINCESS_TOKEN, milestone=MILESTONE)
try:
resp = urllib2.urlopen(url)
except urllib2.HTTPError as ex:
sys.stderr.write("Error fetching {}: {}\n".format(url, ex))
oldest_issue = json.loads(resp.read())[0]
print "The least recently updated issue for milestone '{}' belongs to {} and has been unloved since {}: {}".format(
oldest_issue['milestone']['title'],
oldest_issue['assignee']['login'],
humanize.naturalday(dateutil.parser.parse(oldest_issue['updated_at'])),
oldest_issue['html_url'],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment