[英]Cannot list repository webhooks using personal access token in private repo
I'm working on two repos, one is private and one is public.我正在处理两个回购协议,一个是私人的,一个是公共的。 In the public repo, I can create a personal access token with repo/webhooks admin permissions and I can run the following command:
在公共 repo 中,我可以创建一个具有 repo/webhooks 管理员权限的个人访问令牌,我可以运行以下命令:
curl -si https://api.github.com/repos/{user}/{repo}/hooks -H "Authorization: token {token}"
and I get back []
, an empty list because there's no webhooks.然后我返回
[]
,这是一个空列表,因为没有 webhook。
In the private repo, if I create a personal access token, even with all permissions, I always get:在私人仓库中,如果我创建个人访问令牌,即使拥有所有权限,我总是会得到:
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/webhooks/repos#list-repository-webhooks"
}
What's going on here?这里发生了什么? Is it possible that programmatic access to webhooks is somehow disabled by the repo owner or something?
回购所有者或其他人是否有可能以某种方式禁用对 webhooks 的编程访问?
I can see other resources of the private repo with the token though, like /repos/{user}/{repo}/branches
.不过,我可以看到带有令牌的私人回购的其他资源,比如
/repos/{user}/{repo}/branches
。 It is specifically /hooks
that does not work.特别是
/hooks
不起作用。
Found the problem.发现了问题。 In order to access webhooks via the github API the token needs to be bound to an account with a role that has the
Manage Webhooks
permissions.为了通过 github API 访问 webhooks,令牌需要绑定到具有
Manage Webhooks
权限的角色的帐户。
On my personal repo, I had the admin
role which has that permission by default, on the private repo I had the write
role which does not.在我的个人回购协议中,我拥有默认具有该权限的
admin
角色,在私人回购协议中我拥有write
角色,但没有。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.