如何解决如何使用 Github V3 API 获取无法与父级比较的 fork 的提交前/后数据?
我写了一个 Firefox extension 来让 Github“分叉”页面更有用。我需要为每个分叉提交前/后数据。
为了正确地做到这一点,我尝试通过 jQuery AJAX 请求使用 Github REST API:
const url = `https://api.github.com/repos/${parent_owner}/${repo_name}/compare/${parent_branch}...${child_owner}:${child_branch}`;
console.log(url);
$.ajax({
url: url,async: false,headers: {
Accept: "application/vnd.github.v3+json",Authorization: `token ${token}`
},success : function(response) {
const commits_ahead = response.ahead_by;
const commits_behind = response.behind_by;
const status = response.status;
console.log(`ahead: ${commits_ahead},behind: ${commits_behind},status: ${status}`);
},error : function(jqXHR,textStatus,errorThrown){
console.log(errorThrown);
}
});
但 Github 显示了无法与父级比较的 fork repos 上的提交前/后数据,例如:https://github.com/1292765944/tensorflow
还有其他方法可以通过 Github REST API 获取此类数据吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。