Commits stats from github using graphql

╄→гoц情女王★ 提交于 2021-02-08 03:46:25

问题


Can someone tell me - is where are a way to get all commits of specific repository with stats using graphql api? For now i end with query like this:

query {
  viewer {

  repository(name: "CRM_system") {
    ref(qualifiedName: "master") {
      target {
        ... on Commit {
          id
          history(since: my_date_time) {
            edges {
              node {
                messageHeadline
                oid
                message
                author {
                  name
                  email
                  date
                }
              }
            }
          }
        }
      }
    }
  }
}
  }

But it show commits only from 'master' and doesnt show stats at all, i want to see something similar to github rest api:

stats: {
total: 27
additions: 27
deletions: 0}

回答1:


Get answer from support

https://platform.github.community/t/commit-stats-for-commits-in-repository/2193/4

With latest schema change you can do it this way:

query{
  repository(owner:"education",name:"classroom"){
    defaultBranchRef{
      target{
        ... on Commit{
          changedFiles
          additions
          deletions
        }
      }
    }
}


来源:https://stackoverflow.com/questions/44723678/commits-stats-from-github-using-graphql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!