GitLab count total number of issues

后端 未结 1 505
花落未央
花落未央 2021-01-18 13:04

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://         


        
相关标签:
1条回答
  • 2021-01-18 13:21

    for anyone interestered I fixed it with this:

    1. get the project ids of my gitlab

      curl -s -L --header "PRIVATE-TOKEN:XXXXXX" "https://gitlab.XXXXX/api/v4/projects/"

    combined with python -m json.tool and sed and jq and grep to get a list of ids and names.

    then

    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-Pages"
    

    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!

    0 讨论(0)
提交回复
热议问题