【问题标题】:GitHub API permission name for self-hosted GitHub Actions runners?自托管 GitHub Actions 运行器的 GitHub API 权限名称?
【发布时间】:2021-10-17 13:51:45
【问题描述】:

归根结底,我正在尝试实施从此处链接的解决方案:Reuse Github Actions self hosted runner on multiple repositories。但是教程会引导您在 UI 中设置 GitHub 应用程序,我正在尝试通过 API 来完成。


上下文:

  1. 在 GitHub Enterprise v3.0(即将迁移到 v3.1)中创建新的“GitHub 应用”(不是“OAuth 应用”)。

  2. 尝试通过创建“应用清单”(https://docs.github.com/en/enterprise-server@3.0/developers/apps/building-github-apps/creating-a-github-app-from-a-manifest) 完全通过 API 而不是 UI 来完成。

  3. 我在 docs.github.com 上阅读的有关权限的所有内容最终都指向 https://docs.github.com/en/enterprise-server@3.0/rest/reference/permissions-required-for-github-apps,这包含可用于 API 的特定值。

  4. 在 GHE 实例上,具有此模式的 URL 上有大量可用权限:

    https://{HOSTNAME}/organizations/{ORG}/settings/apps/{APP}/permissions
    
  5. 我正在尝试设置的特定权限说:

    自托管跑步者
    查看和管理可供组织使用的 Actions 自托管运行器。
    访问:读写

  6. 在文档 (https://docs.github.com/en/enterprise-server@3.0/developers/apps/building-github-apps/creating-a-github-app-from-a-manifest#github-app-manifest-parameters) 中有一个名为 default_permissions 的参数。

    用于此权限的标识符(键)是什么,其值为write

    我试过了:

    • 记录在案的Self-hosted runners
    • 猜测self-hosted runners
    • 猜测self-hosted_runners
    • 猜测self_hosted_runners
    • 猜测selfhosted_runners
    • 猜测runners

    ...但最终,可以在此处使用的实际值是(据我在几个小时的挖掘和猜测后所知)没有记录

    actions:readchecks:read 似乎可以工作。这些是没有记录的,但我能够通过查看 URL、做出有根据的猜测和测试来弄清楚。

  7. 我可以在 Internet 上找到的所有教程,包括 docs.github.com 上的教程,都将引导您通过 UI 创建一个新的 GitHub 应用程序。我非常明确地尝试通过 API 执行此操作。

有什么建议吗?我错过了什么吗?这在 GHE 中还没有吗?


这是我的应用清单,已编辑。

{
  "public": true,
  "name": "My app",
  "description": "My app's description.",
  "url": "https://github.example.com/my-org/my-repo",
  "redirect_url": "http://localhost:9876/register/redirect",
  "default_events": [],
  "default_permissions": {
    "actions": "read",
    "checks": "read",
    "runners": "write"
  },
  "hook_attributes": {
    "url": "",
    "active": false
  }
}

"runners": "write" 行中,我收到的错误消息是:

GitHub 应用配置无效
该配置似乎不是有效的 GitHub 应用清单。
× 错误 默认权限记录资源不在列表中

没有"runners": "write" 行,提交成功。

【问题讨论】:

    标签: github permissions github-actions github-api github-app


    【解决方案1】:

    GitHub 团队终于更新了文档。我正在寻找的权限是organization_self_hosted_runners

    【讨论】:

      猜你喜欢
      • 2020-07-22
      • 2021-10-21
      • 2020-09-14
      • 2021-11-02
      • 2022-07-14
      • 2020-11-20
      • 2020-11-28
      • 2020-05-13
      • 1970-01-01
      相关资源
      最近更新 更多