Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rest Github API将用户代码合并到特定repo的主分支中_Rest_Github_Github Api - Fatal编程技术网

Rest Github API将用户代码合并到特定repo的主分支中

Rest Github API将用户代码合并到特定repo的主分支中,rest,github,github-api,Rest,Github,Github Api,我刚刚问了一个关于GitHub的RESTAPI的问题,我正在查看文档,但似乎找不到我要找的内容。有没有办法查看用户在特定回购协议的一段时间内合并到主分支中的代码量 从本质上说,我想得到 用户x提交的x代码行范围为2020年5月至2021年5月。类似的东西。githubapi 不幸的是,Github API没有提供这些信息(还没有),您只能获得用户通过服务对存储库所做的贡献 解决方法 似乎有一个解决办法: 查阅此URL:https://github.com///graphs/contributor

我刚刚问了一个关于GitHub的RESTAPI的问题,我正在查看文档,但似乎找不到我要找的内容。有没有办法查看用户在特定回购协议的一段时间内合并到主分支中的代码量

从本质上说,我想得到


用户
x
提交的
x
代码行范围为
2020年5月
2021年5月
。类似的东西。

githubapi

不幸的是,Github API没有提供这些信息(还没有),您只能获得用户通过服务对存储库所做的贡献

解决方法

似乎有一个解决办法:

查阅此URL:
https://github.com///graphs/contributors
,我注意到以下申请是为了填写贡献者数据:

  • 请求URL:
    https://github.com///graphs/contributors-data
  • 请求方法:
    GET
  • 请求标题:不确定
此端点将返回类似于以下对象的内容:

[
  {
     "total":N,
     "author":{
        "id":<user_id>,
        "login":"<user_name>",
        "avatar":"<user_avatar>",
        "path":"/<user_name>",
        "hovercard_url":"/users/<user_name>/hovercard"
     },
     "weeks":[
        {
           "w":1586044800,
           "a":0,
           "d":0,
           "c":0
        },
        {
           "w":1586649600,
           "a":0,
           "d":0,
           "c":0
        },
        ...
     ]
   }
 ]
[
{
“总计”:N,
“作者”:{
“id”:,
“登录”:“,
“化身”:“,
“路径”:“/”,
“hovercard\u url”:“/用户//hovercard”
},
“周”:[
{
“w”:1586044800,
“a”:0,
“d”:0,
“c”:0
},
{
“w”:1586649600,
“a”:0,
“d”:0,
“c”:0
},
...
]
}
]
在此响应中,您将看到一个包含
贡献者详细信息的贡献者列表,其中:

  • total
    :表示此用户对存储库的贡献量

  • 作者
    :Github用户数据

  • 周数
    :每周贡献的列表,其中每周:

    • w
      :是周id
    • a
      :添加的行数
    • d
      :删除的行数
    • c
      :提交的数量
因此,为了得到您想要的,您必须为每个用户合计所有周的贡献

观察:我理解,要做到这一点,您需要访问存储库洞察(任何用户都可能无法使用这些洞察)