统计gitlab代码仓库开发人员代码贡献数量

  • Post author:
  • Post category:其他


统计每个项目代码开发人员不定时间内的代码贡献数, 并自动导出Excel表。能快速知道哪些开发人员一天一天的在摸鱼

# coding=utf-8
# author: zhangzihong

import time
import gitlab
import collections
import pandas as pd


gl = gitlab.Gitlab('http://gitlab.xxx.com/',private_token='ve9ifEu9ZtAeqWik',timeout=500, api_version='4')


start_time = '2020-10-16T00:00:00Z'
end_time = '2020-11-16T23:00:00Z'


def get_gitlab():
    """
    gitlab API 
    """
    list2 = []
    projects=gl.projects.list(owned=True, all=True)
    num=0
    for project in projects:
        num+=1
        print("查看了%d个项目" %num)
        for branch in project.branches.list():
            commits=project.commits.list(all=True,query_parameters={'since': start_time,'until':end_time, 'ref_name': branch.name})
            
            for commit in commits:
   



版权声明:本文为ffzhihua原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。