通过REST API启用GitHub动作

发布于 2025-02-08 13:05:24 字数 1878 浏览 1 评论 0原文

我有一个带有许多存储库的组织的本地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"
}

即使我试图强制启用它,根据文档

put https://my.github.example.com/api/api/v3/orgs/myorg/myorg/myorg/actions/permissions/permissions/repositories/repositories/the-repository < /a>我得到:

{
    "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:

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文