【发布时间】:2021-11-10 04:13:48
【问题描述】:
由于 Github API 还不支持获取包含提交 (SHA) 的分支。所以我发现如果我们可以从 URL https://github.com/:org/:repo/branch_commits/:sha 解析 HTML,我们可以得到分支。但目前,即使我有凭据,我也无法连接到此 URL(用于私人仓库)
const url = `https://github.com/${org}/${repo}/branch_commits/${hash}`;
const options = {
method: 'GET',
uri: url,
headers: {
"Authorization": token,
}
};
request(options).then(result => {
console.log(result);
}).catch(err => {
console.log(err);
});
结果是404 Not Found。
有人知道吗?
谢谢!!
【问题讨论】:
标签: javascript node.js typescript github request-promise