manbetx客户端打不开计数问题总数 [英] GitLab count total number of issues
问题描述
我想使用api计算我的gitlab项目中的所有问题.
I would like to count all issues on my gitlab project using api.
在我正在使用的命令下面:
Below the command that I'm using:
curl --header "PRIVATE-TOKEN:xxxxxxx" https://gitlab.myapp.com/api/v4/groups/xx/issues?scope=all
我还试图用项目替换组.
I've also tried to replace groups with project.
我们想绕过分页问题:显示的结果始终为100(最大数量).
We would like to bypass the pagination problem: the displayed results are always 100 (the max number).
我们怎么能得到超过100个?
How can we could get more than 100 ?
因此,我只希望获得项目总数.
I would like to have as result only the total number of issue on my project.
推荐答案
对于有兴趣的人,我用以下方法解决了这个问题:
for anyone interestered I fixed it with this:
1)获取我的gitlab的项目ID
1) get the project ids of my gitlab
curl -s -L --header "PRIVATE-TOKEN:XXXXXX" "https://gitlab.XXXXX/api/v4/projects/"
与python -m json.tool
和sed
和jq
和grep
组合以获取ID和名称的列表.
combined with python -m json.tool
and sed
and jq
and grep
to get a list of ids and names.
然后
我获得了有关项目ID的总发行页数
I get the number of total pages of issues for project ids
curl -s --head --header "PRIVATE-TOKEN:XXXXXX" "https://gitlab.XXXXX/api/v4/projects/${id}/issues?state=all&per_pages=100"
| grep "X-Total-Page"
然后我用while
循环提取所有问题:
then I extract all the issues with a while
cycle:
curl -s --header "PRIVATE-TOKEN:XXXXX" "https://gitlab.XXXX/api/v4/projects/${id}/issues?scope=all&state=all&label_name\[\]=BU
G&page=${i}&per_page=100"
$i is the page counter
我希望这可以帮助其他人!
I hope this could help someone else!
如果您有任何疑问,请随时提问!
If you have questions, feel free to ask!
这篇关于manbetx客户端打不开计数问题总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!