graphql学习
发布于 3 天前 作者 qjzd 27 次浏览 来自 码农
6 回复

github 列出readme

query {
  repository(owner: "nqdy666", name: "little-think") {
    object(expression: "master:README.md") {
      ... on Blob {
        text
      }
    }
  }
}

github列出issue

query {
  repository(owner:"nqdy666", name:"little-think") {
    issues(last:20, states:CLOSED) {
      edges {
        node {
          title
          url
          labels(first:5) {
            edges {
              node {
                name
              }
            }
          }
        }
      }
    }
  }
}

github列出仓库的信息

{
  repository(owner: "nqdy666", name: "little-think") {
    id
    name
    description
  }
}

github仓库下某个文件夹下的文件

{
  repository(owner: "nqdy666", name: "little-think") {
    object(expression: "master:201910") {
      ... on Tree {
        entries {
          name
        }
      }
    }
  }
}

https://github.community/t5/GitHub-API-Development-and/GraphQL-getting-filename-file-content-and-commit-date/td-p/17861

github获取仓库根文件列表

{
  repository(owner: "nqdy666", name: "little-think") {
    object(expression: "master:") {
      ... on Tree {
        entries {
		  type,
          name
        }
      }
    }
  }
}

github 递归出列表的的一种方式

{
  repository(owner: "nqdy666", name: "little-think") {
    object(expression: "master:") {
      ... on Tree {
        entries {
          name
          object {
            ... on Tree {
              entries {
                name
                object {
                  ... on Tree {
                    entries {
                      name
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
回到顶部