如何使用github api列出目录下的所有文件名?

zer*_*msi 4 git api github

我需要列出我的存储库目录下的所有文件名。

以下 api 可以列出根目录中的文件名和目录。

https://api.github.com/repos/username/repo-name/git/trees/master?recursive=1

发现没有合适的 api 来明智地列出目录!

The*_*ear 8

使用https://api.github.com/repos/{owner}/{repo}/contents/{path}

请参阅此处的文档:https ://docs.github.com/en/rest/reference/repos#get-repository-content