我正在使用带有节点的 octokit 并尝试获取单个提交详细信息
但得到 404
生成个人访问令牌、所有者等。
对于我的私人仓库它正在工作但对于组织私人仓库不工作我刚刚获得了所有者对组织的访问权限并更新了令牌
const { IncomingWebhook } = require('@slack/client');
const humanizeDuration = require('humanize-duration');
const Octokit = require('@octokit/rest');
const GITHUB_ACCESS_TOKEN = 'XXXXXXXXXXXXXXXXXXXXX';
const token = GITHUB_ACCESS_TOKEN;
const octokit = require('@octokit/rest')({
auth: `token ${token}`
})
module.exports.getGithubCommit = async (build, octokit) => {
try {
console.log("Inside Github function");
const githubRepo = 'XXXXXXXXXXXXXX';
const githubBranch = 'XXXXXXXXXXXXX';
const commitSha = 'XXXXXXXXXXXXXXXX';
const githubCommit = await octokit.git.getCommit({
commit_sha: commitSha,
owner: 'harshmanvar',
repo: githubRepo,
});
console.log("Github commit value",githubCommit);
return githubCommit;
} catch (err) {
console.log('error',err);
return err;
}
};
const githubCommit = module.exports.getGithubCommit(build, octokit);
让我知道我是否遗漏了什么,这是由于刚刚获得了组织的访问权限,所以我无法访问较旧的提交详细信息?
当我试图在我找到的所有存储库中列出组织存储库时
owner : [object]
{ id: 12345674890,
node_id: 'XXXXXXXXXXXXXXXXXXXX',
name: 'XXXXX',
full_name: 'XXXXXXXXXXXX',
private: true,
owner: [Object],
html_url: 'https://github.com/org/XXXXXXXXXXXXX',
description: null,
fork: false,