【问题标题】:GitHub GraphQL fetch repositories that are not archivedGitHub GraphQL 获取未归档的存储库
【发布时间】:2018-12-28 09:02:46
【问题描述】:

有没有办法只获取未归档的存储库?

{
  user(login: "SrikanthBandaru") {
    id
    email
    isHireable
    name
    repositories(first: 100) { # fetch only the repos that are not archived
      edges {
        node {
          name
          isArchived
          shortDescriptionHTML
          description
          descriptionHTML
          repositoryTopics(first: 10) {
            edges {
              node {
                topic {
                  name
                }
              }
            }
          }
          homepageUrl
          url
        }
      }
    }
  }
}

【问题讨论】:

    标签: graphql github-api github-graphql


    【解决方案1】:

    除了带有archived search parameter 的用户查询外,您还可以使用搜索查询。也可以使用fork:true 来包含分叉:

    {
      user: user(login: "simon04") {
        id
        email
        isHireable
        name
      }
      repos: search(query: "user:simon04 fork:true archived:false", type: REPOSITORY, first: 100) {
        repositoryCount
        edges {
          node {
            ... on Repository {
              nameWithOwner
              name
              isArchived
              shortDescriptionHTML
              description
              descriptionHTML
              repositoryTopics(first: 10) {
                edges {
                  node {
                    topic {
                      name
                    }
                  }
                }
              }
              homepageUrl
              url
            }
          }
        }
      }
    }
    

    Try it in the explorer

    【讨论】:

    • 啊..!!谢谢!!
    猜你喜欢
    • 2018-05-31
    • 2018-06-25
    • 1970-01-01
    • 2019-12-11
    • 1970-01-01
    • 2020-03-16
    • 2020-09-28
    • 2022-07-30
    • 2017-09-01
    相关资源
    最近更新 更多