[英]In Github's GraphQL API how to get repositories that do not have a particular repositoryTopic?
With Github's GraphQL API I recently found " Github API: Getting topics of a Github repository " that mentions you can get a count of topics: With Github's GraphQL API I recently found " Github API: Getting topics of a Github repository " that mentions you can get a count of topics:
{
repository(owner: "twbs", name: "bootstrap") {
repositoryTopics(first: 10) {
edges {
node {
topic {
name
}
}
}
}
}
}
but in the docs and in my search I'm not finding how I can query repositories that do not contain the topic template
, example:但是在文档和搜索中,我没有找到如何查询不包含主题template
的存储库,例如:
query ($github_org: String!, $repo_count: Int!) {
organization(login: $github_org) {
repositories(first: $repo_count, privacy: PUBLIC, isFork: false) {
nodes {
id
name
openGraphImageUrl
createdAt
stargazerCount
url
description
repositoryTopics(first: 10, after: "template") {
edges {
node {
id
}
}
}
}
}
}
}
is the correct implementation to use after
? after
使用的正确实现是什么? In Github's GraphQL API how to exclude a repository if it contains a certain topic?在 Github 的 GraphQL API 中如何排除包含某个主题的存储库?
My understanding is that with the organization query you cannot do that kind of repository filtering.我的理解是,对于组织查询,您无法进行那种存储库过滤。
Instead, you can use the search query with something like this:相反,您可以将搜索查询与以下内容一起使用:
query ($repo_count: Int!) {
search (first: $repo_count,
type: REPOSITORY,
query: "org:my-organization topic:my-topic") {
nodes {
... on Repository {
name
}
}
}
}
The above query searches for all repositories within a given organization that have a given topic.上述查询搜索给定组织内具有给定主题的所有存储库。
But you were looking for the repositories without a topic, in theory according to the documentation you should be able to do that with -topic:my-topic
.但是您正在寻找没有主题的存储库,理论上根据文档您应该能够使用-topic:my-topic
来做到这一点。 Unfortunately the negation on topic doesn't work, there seems to be a bug .不幸的是,对主题的否定不起作用,似乎有一个错误。 :-( :-(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.