【问题标题】:Graph QL query for all the comments on PR of given authorGraphql 查询给定作者对 PR 的所有评论
【发布时间】:2020-08-08 03:01:25
【问题描述】:

我想出了这个:

{
  repository(owner: "hawkular", name: "hawkular.github.io") {
    pullRequest(number: 237) {
      comments(first: 10) {
        nodes {
          body
          author {
            login
          }
        }
      }
    }
  }
}

返回给定 PR 上的所有 cmets:

{
  "data": {
    "repository": {
      "pullRequest": {
        "comments": {
          "nodes": [
            {
              "body": "PR was auto-deployed here: http://209.132.178.114:10237 and it will be available for 4 days.\n",
              "author": {
                "login": "hawkular-website-bot"
              }
            },
            {
              "body": "Any ETA for this blog post to be finished/published ?",
              "author": {
                "login": "theute"
              }
            },
            {
              "body": "After PR696 in hawkular-metrics I will continue.. helps me to create something repetable",
              "author": {
                "login": "burmanm"
              }
            },
            {
              "body": "PR was auto-deployed here: http://209.132.178.114:10237 and it will be available for 4 days.",
              "author": {
                "login": "hawkular-website-bot"
              }
            },
            {
              "body": "The article cites `CompressionData` job, but it should be `CompressData`.",
              "author": {
                "login": "jsanda"
              }
            },
            {
              "body": "Is this PR active ? Severla months without activity.",
              "author": {
                "login": "lucasponce"
              }
            }
          ]
        }
      }
    }
  }

但是我只对hawkular-website-bot 写的那些感兴趣。有没有办法在 Git Hub Graph QL api 中指定作者?

【问题讨论】:

    标签: graphql github-api


    【解决方案1】:

    PullRequestConnection 类型中的作者没有过滤条件。所以你不能根据作者过滤拉取请求。但是您可以使用搜索查询功能,例如

    {
      search(query: "repo: hawkular/hawkular.github.io is:pr is:open author:hawkular-website-bot", last:10, type:ISSUE){
        edges{
          node{
            ... on PullRequest{
              body
              title
            }
          }
        }
      }
    }
    

    详情见this

    【讨论】:

      猜你喜欢
      • 2019-01-29
      • 1970-01-01
      • 2016-11-25
      • 2018-10-22
      • 2015-12-02
      • 2017-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多