通过REST API启用GitHub动作
我有一个带有许多存储库的组织的本地github实例。有些似乎有动作禁用操作:
/myorg/the-repository/actions/permissions“ rel =“ nofollow noreferrer”> https://my.github.example.com/api/api/v3/repos/repos/myorg/the-repository/cositority/actions/actions/permissions 结果结果在:
{
"enabled": true,
"allowed_actions": "selected",
"selected_actions_url":
"https://my.github.example.com/repositories/21251/actions/permissions/selected-actions"
}
即使我试图强制启用它,根据文档:
{
"message": "Conflict",
"errors": "GitHub Actions is enabled for all repositories",
"documentation_url": "https://docs.github.com/enterprise/3.4/rest/reference/actions#enable-a-selected-repository-for-github-actions-in-an-organization"
}
至于UI中的按钮(上面的屏幕截图),这有效。其背后的代码是:
<form class="" method="post" action="/myorg/the-repository/actions/enable">
<input class="btn btn-primary my-3" type="submit" value="Enable Actions on this repository">
<input type="hidden" name="authenticity_token" value="asdlkjflasdkjflaskjflasdkjflkasdjf">
</form>
但是它不发布到REST API,而是Web UI(显然)。
I have an on-prem GitHub instance with an org with many repos. Some seem to have actions Actions disabled:
However, if I query this through the REST API:
GET https://my.github.example.com/api/v3/repos/myorg/the-repository/actions/permissions results in:
{
"enabled": true,
"allowed_actions": "selected",
"selected_actions_url":
"https://my.github.example.com/repositories/21251/actions/permissions/selected-actions"
}
And even if I try to forcefully enable it, according to the docs:
PUT https://my.github.example.com/api/v3/orgs/myorg/actions/permissions/repositories/the-repository I get:
{
"message": "Conflict",
"errors": "GitHub Actions is enabled for all repositories",
"documentation_url": "https://docs.github.com/enterprise/3.4/rest/reference/actions#enable-a-selected-repository-for-github-actions-in-an-organization"
}
As for the button in the UI (the screenshot above), this works. The code behind it is:
<form class="" method="post" action="/myorg/the-repository/actions/enable">
<input class="btn btn-primary my-3" type="submit" value="Enable Actions on this repository">
<input type="hidden" name="authenticity_token" value="asdlkjflasdkjflaskjflasdkjflkasdjf">
</form>
However it doesn't post to the REST API but the Web UI (obviously)..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论