Browse Source

Make contributions skripts handle more than 100 issues/merge requests

environments/review-docs-gener-yhsoze/deployments/8743
Georg Krause 5 months ago
parent
commit
6a4f332f6f
No known key found for this signature in database GPG Key ID: FD479B9A4D48E632
  1. 42
      scripts/get-contributions-stats.py

42
scripts/get-contributions-stats.py

@ -10,28 +10,36 @@ WEBLATE_COMPONENT_ID = "funkwhale/front"
def get_issues(next_release):
url = GITLAB_URL + "/api/v4/issues"
# TODO assumes we have less than 100 issues per Milestone
response = requests.get(
url,
params={"per_page": 100, "milestone": next_release, "scope": "all"},
headers={"PRIVATE-TOKEN": os.environ["PRIVATE_TOKEN"]},
)
response.raise_for_status()
while url:
response = requests.get(
url,
params={"per_page": 20, "milestone": next_release, "scope": "all"},
headers={"PRIVATE-TOKEN": os.environ["PRIVATE_TOKEN"]},
)
response.raise_for_status()
yield from response.json()
return response.json()
if "next" in response.links:
url = response.links["next"]["url"]
else:
url = None
def get_merge_requests(next_release):
url = GITLAB_URL + "/api/v4/merge_requests"
# TODO assumes we have less than 100 issues per Milestone
response = requests.get(
url,
params={"per_page": 100, "milestone": next_release, "scope": "all"},
headers={"PRIVATE-TOKEN": os.environ["PRIVATE_TOKEN"]},
)
response.raise_for_status()
return response.json()
while url:
response = requests.get(
url,
params={"per_page": 20, "milestone": next_release, "scope": "all"},
headers={"PRIVATE-TOKEN": os.environ["PRIVATE_TOKEN"]},
)
response.raise_for_status()
yield from response.json()
if "next" in response.links:
url = response.links["next"]["url"]
else:
url = None
def get_participants(project_id, issue_iid, object_type="issues"):

Loading…
Cancel
Save