Repo report: last n
issues¶
In [1]:
import csv
import json
import os
import pprint
import pandas as pd
import requests
In [2]:
# get api token and set authorization
api_token = os.environ['GITHUB_API_TOKEN']
headers = {'Authorization': f'token {api_token}'}
In [3]:
# set url to a graphql endpoint
url = 'https://api.github.com/graphql'
In [4]:
# add a json query
query = """
{
organization(login: "jupyterhub") {
name
repository(name: "binderhub") {
name
issues(last: 5) {
edges {
node {
number
title
}
}
}
}
}
}
"""
In [5]:
# submit the request
r = requests.post(url=url, json={'query': query}, headers=headers)
In [6]:
binderhub = r.json()
binderhub
Out[6]:
{'data': {'organization': {'name': 'JupyterHub',
'repository': {'issues': {'edges': [{'node': {'number': 344,
'title': 'Improve CONTRIBUTING.md'}},
{'node': {'number': 345,
'title': 'Upgrade to kubernetes client version 4.0'}},
{'node': {'number': 349,
'title': 'race condition mounting docker-in-docker socket in build'}},
{'node': {'number': 350,
'title': 'Consider *not* launching automatically'}},
{'node': {'number': 351, 'title': 'Awesome bar functionality'}}]},
'name': 'binderhub'}}}}
In [7]:
issue_list = binderhub['data']['organization']['repository']['issues']['edges']
issue_list
Out[7]:
[{'node': {'number': 344, 'title': 'Improve CONTRIBUTING.md'}},
{'node': {'number': 345,
'title': 'Upgrade to kubernetes client version 4.0'}},
{'node': {'number': 349,
'title': 'race condition mounting docker-in-docker socket in build'}},
{'node': {'number': 350, 'title': 'Consider *not* launching automatically'}},
{'node': {'number': 351, 'title': 'Awesome bar functionality'}}]
Report: Last 5 issues for a repo¶
In [8]:
print(f"{binderhub['data']['organization']['repository']['name']}: last five issues submitted")
for issue in issue_list:
print(f"{issue['node']['number']:6} {issue['node']['title']:30}")
binderhub: last five issues submitted
344 Improve CONTRIBUTING.md
345 Upgrade to kubernetes client version 4.0
349 race condition mounting docker-in-docker socket in build
350 Consider *not* launching automatically
351 Awesome bar functionality
Let’s try another repo - make it a little more generic using
response
as a variable - select last 10 issues
In [9]:
# add a json query
query = """
{
organization(login: "jupyterhub") {
name
repository(name: "jupyterhub") {
name
issues(last: 10) {
edges {
node {
number
title
}
}
}
}
}
}
"""
r = requests.post(url=url, json={'query': query}, headers=headers)
response = r.json()
issue_list = response['data']['organization']['repository']['issues']['edges']
In [10]:
print(f"{response['data']['organization']['repository']['name']}: last 10 issues submitted")
for issue in issue_list:
print(f"{issue['node']['number']:6} {issue['node']['title']:30}")
jupyterhub: last 10 issues submitted
1573 more activity tracking
1574 Jupyter cannot find Three.Js files - URL redirection not working *updated*
1576 anchor links on markdown docs pages are unreliable
1579 LocalAuthenticator question
1580 Specify Kubernetes volume claims in Jupyterhub spawner
1582 Jupyterhub shared service error
1583 c.JupyterHub.logo_file is not working on after Jupyterhub Version: 0.8.1 upgrade
1584 config c.LocalProcessSpawner.mem_limit Issue
1585 Prometheus metrics to add to JupyterHub
1586 Errno 8: Nodename nor servname provided