Skip to content

Instantly share code, notes, and snippets.

@Ry4an
Created July 7, 2014 01:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ry4an/4c72056dcfeb06f1d8a3 to your computer and use it in GitHub Desktop.
Save Ry4an/4c72056dcfeb06f1d8a3 to your computer and use it in GitHub Desktop.
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