【问题标题】:Github Graphql Filter issues which has multiple labels具有多个标签的 Github Graphql 过滤器问题
【发布时间】:2021-09-02 13:46:28
【问题描述】:

此查询返回具有label1 或label2 的问题。基本上,它返回了label1 和label2 的所有问题。

{
  repository(owner: "another-user", name: "another-repo") {
    issues(first: 100, filterBy: { labels:  ["label1", "label2"}"] }) {
      nodes {
        title
        body
        bodyHTML
        bodyText
        number
        labels(first: 100) {
          nodes {
            color
            name
            id
          }
        }
        author {
          url
          avatarUrl
          login
        }
      }
    }
  }
}

我试图找到具有label1 和label2 标签的一个特定问题。如何执行AND操作?

【问题讨论】:

    标签: graphql github-api


    【解决方案1】:

    除了返回带有这些标签的所有问题然后过滤客户端(文档https://docs.github.com/en/graphql/reference/input-objects#issuefilters)之外,无法使用 graphql API。

    您可以使用搜索 API 代替 https://docs.github.com/en/rest/reference/search#search-issues-and-pull-requests。

    尚未测试,但我认为这样的事情应该可以完成工作

    q=label:label1+label:label2+repo:another-user/another-repo
    

    【讨论】:

      猜你喜欢
      • 2018-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-13
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多