Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Keunes
funkwhale
Commits
6a4f332f
Verified
Commit
6a4f332f
authored
Dec 14, 2021
by
Georg Krause
Browse files
Make contributions skripts handle more than 100 issues/merge requests
parent
a4c51faa
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/get-contributions-stats.py
View file @
6a4f332f
...
...
@@ -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"
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment