Ocotkit 无法获得组织私有回购提交



我正在使用带有节点的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,

要从组织存储库获取提交详细信息,我们必须将组织名称作为所有者传递。

commit_sha: commitSha,
owner: 'acme-org',
repo: githubRepo,

相关内容

  • 没有找到相关文章

最新更新