Using a configuration file to list repos

This commit is contained in:
Alexandre Aubin 2017-03-08 10:56:24 -05:00
parent 2b770bb8ae
commit a0dd6dabfd
4 changed files with 44 additions and 16 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
data/*.json data/*.json
www

View file

@ -3,14 +3,24 @@
import json import json
import datetime import datetime
repos = ["yunohost", "yunohost-admin", "SSOwat", "moulinette", "doc", "ynh-dev",
"apps", "CI_package_check", "example_ynh", "package_linter", "Simone",
"project-organization", "build.yunohost.org", "dynette", "YunoPorts",
"rebuildd", "cd_build", "install_script"]
prs = {} prs = {}
def get_repos():
repos_by_name = {}
with open("repos.json", "r") as f:
repos_by_team = json.loads(f.read())
for team, team_repos in repos_by_team.items():
for repo in team_repos:
if repo not in repos_by_name.keys():
repos_by_name[repo] = [team]
else:
repos_by_name[repo].append(team)
return repos_by_name
def githubDateToDaysAgo(date): def githubDateToDaysAgo(date):
now = datetime.datetime.now() now = datetime.datetime.now()
@ -44,7 +54,7 @@ def priority(pr):
def main(): def main():
for repo in repos: for repo, teams in get_repos().items():
print("Analyzing %s ..." % repo) print("Analyzing %s ..." % repo)
@ -64,12 +74,10 @@ def main():
"id": "%s-%s" % (repo, issue["number"]), "id": "%s-%s" % (repo, issue["number"]),
"createdDaysAgo": githubDateToDaysAgo(issue["created_at"]), "createdDaysAgo": githubDateToDaysAgo(issue["created_at"]),
"updatedDaysAgo": githubDateToDaysAgo(issue["updated_at"]), "updatedDaysAgo": githubDateToDaysAgo(issue["updated_at"]),
"url": issue["pull_request"]["html_url"] "url": issue["pull_request"]["html_url"],
"teams": teams
} }
#if len(pr["title"]) > 53:
# pr["title"] = pr["title"][0:50] + "..."
if isPRDying(pr): if isPRDying(pr):
pr["labels"].append("dying") pr["labels"].append("dying")
pr["priority"] = priority(pr) pr["priority"] = priority(pr)

View file

@ -1,14 +1,25 @@
#!/usr/bin/python3 #!/usr/bin/python3
import requests import requests
import json
repos = ["yunohost", "yunohost-admin", "SSOwat", "moulinette", "doc", "ynh-dev", def get_repos():
"apps", "CI_package_check", "example_ynh", "package_linter", "Simone",
"project-organization", "build.yunohost.org", "dynette", "YunoPorts",
"rebuildd", "cd_build", "install_script"]
repos_by_name = {}
for repo in repos: with open("repos.json", "r") as f:
repos_by_team = json.loads(f.read())
for team, team_repos in repos_by_team.items():
for repo in team_repos:
if repo not in repos_by_name.keys():
repos_by_name[repo] = [team]
else:
repos_by_name[repo].append(team)
return repos_by_name
for repo in get_repos().keys():
print("Fetching pull requests for %s" % repo) print("Fetching pull requests for %s" % repo)

8
repos.json Normal file
View file

@ -0,0 +1,8 @@
{
"core": ["yunohost", "yunohost-admin", "SSOwat", "moulinette", "Vagrantfile",
"ynh-dev" ],
"doc": [ "doc", "Simone", "project-organization" ],
"apps": [ "apps", "CI_package_check", "example_ynh", "package_linter" ],
"infra": [ "build.yunohost.org", "dynette", "YunoPorts", "rebuildd", "cd_build",
"install_script", "trotinette","bicyclette", "Vagrantfile"]
}