【发布时间】:2016-03-02 20:01:53
【问题描述】:
如何获取包含特定文件的最新提交?我目前正在从我的仓库中的特定目录中检索所有文件,就像这样
https://api.github.com/repos/' + this.fullRepoUrl + '/contents' + this.path
返回一系列看起来像这样的对象
{
"name": "preview-whats-to-come.md",
"path": "posts/preview-whats-to-come.md",
"sha": "08bf61b7b1a8895cd1415f93f40315f4c5ef8bf9",
"size": 1861,
"url": "https://api.github.com/repos/user/repo/contents/posts/preview-whats-to-come.md?ref=master",
"html_url": "https://github.com/user/repo/blob/master/posts/preview-whats-to-come.md",
"git_url": "https://api.github.com/repos/user/repo/git/blobs/08bf61b7b1a8895cd1415f93f40315f4c5ef8bf9",
"download_url": "https://raw.githubusercontent.com/user/repo/master/posts/preview-whats-to-come.md",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/user/repo/contents/posts/preview-whats-to-come.md?ref=master",
"git": "https://api.github.com/repos/user/repo/git/blobs/08bf61b7b1a8895cd1415f93f40315f4c5ef8bf9",
"html": "https://github.com/user/repo/blob/master/posts/preview-whats-to-come.md"
}
}
我考虑过使用 sha 并基于它拉入一个提交,但它不是最近提交的 sha
【问题讨论】:
标签: github github-api