-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGithubInfo.py
27 lines (24 loc) · 1.21 KB
/
GithubInfo.py
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
from github import Github
import dash_html_components as html
import os
# First create a Github instance using an access token
g = Github(os.environ["github_token"])
# Then play with your Github objects
def get_pull_requests():
pull_requests = []
for repo in g.get_user().get_repos(): # if repo.name == "DevTraining":
pulls = repo.get_pulls(state='open', base='master')
for i, pr in enumerate(pulls, start=1):
htmll = html.Li([
html.Div([
html.Label(i, className="task_type", style={"width": "20px"}),
html.Div([
html.P(pr.user.login, className="task_name"),
html.P(pr.title, className="task_des")
], className="task_name_des"),
html.P(str(pr.created_at)[:-3], className="date_time"),
html.A(html.Button("Link", className='btn'),href=pr.html_url)
], className="taskticket", style={"height": "35px"})
])
pull_requests.append(htmll)
return pull_requests, len(pull_requests)