WishMeLz

生活其实很有趣

获取github仓库目录

官网文档:https://docs.github.com/en/rest/reference/repos#get-repository-content

GET /repos/{owner}/{repo}/contents/{path}

owner:所有者
repo:仓库名字
path:路劲

例子: https://api.github.com/repos/wozuinbs/video/contents/mini

上述例子最多返回1000条数据。如需全部需要另外一种方法

文档:https://docs.github.com/en/rest/reference/git#get-a-tree

/repos/{owner}/{repo}/git/trees/{tree_sha}

owner:所有者
repo:仓库名字
tree_sha:目录的sha值

sha值通过 https://api.github.com/repos/wozuinbs/video/contents 可以看到每个目录的信息

例子:

https://api.github.com/repos/wozuinbs/video/git/trees/30450e11171827542c972cf1568369b6f9a2ea6b