GitHub-获取在一个月内发表评论或提交任何内容的用户

时间:2020-11-01 06:10:48

标签: github github-api

是否可以通过GitHub API来获取它,如:

https://api.github.com/search/issues?q=is:pr%20state:open%20repo:angular/angular&per_page=100

我对以任何方式为项目做出贡献的任何人感兴趣:具有代码的PR(包括未合并/关闭的PR),创建问题,评论问题或PR的人。

我对评论/ PR中的guthub明星,喜欢或表情符号不感兴趣。

1 个答案:

答案 0 :(得分:0)

您可以使用GraphQL API获得participants的拉取请求和问题,如下例所示:

{
  repository(owner: "mui-org", name: "material-ui") {
    issue(number: 23215) {
      participants(first: 100) {
        nodes {
          login
        }
      }
    }
    pullRequest(number: 23294) {
      participants(first: 100) {
        nodes {
          login
        }
      }
    }
  }
}

您将能够遍历所有问题并在以下查询中拉出请求:

{
  repository(owner: "mui-org", name: "material-ui") {
    issues(first: 100) {
      nodes {
        number
        participants(first: 100) {
          nodes {
            login
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
    pullRequests(first: 100) {
      nodes {
        number
        participants(first: 100) {
          nodes {
            login
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

Try this in the explorer

您还需要使用Github API v3获取contributors(目前无法使用GraphQL v4):

https://api.github.com/repos/mui-org/material-ui/contributors