【问题标题】:Get a list of GitHub runners?获取 GitHub 运行者列表?
【发布时间】:2021-12-29 18:58:21
【问题描述】:

我对 GitHub 工作流程/操作相当陌生,我的任务是获取与跑步者匹配的当前跑步者列表。我正在查看现有的工作流程。

runs-on: ["self-hosted", "management-control-plane", "${{ needs.env.outputs.env }}"]

所以它看起来像是在说'在指定的环境中找到一个我们现有的带有指定标签'management-control-plane'的VM。因此,Github 作为其引用的这些地方的列表。

问题:如何使用标签和环境查询虚拟机列表?谢谢!

【问题讨论】:

    标签: javascript node.js github github-actions


    【解决方案1】:

    您可以使用 REST API 列出您的组织或存储库的所有运行器。

    这是来自docs 的示例:

    curl \
      -H "Accept: application/vnd.github.v3+json" \
      https://api.github.com/orgs/ORG/actions/runners
    
    {
      "total_count": 2,
      "runners": [
        {
          "id": 23,
          "name": "linux_runner",
          "os": "linux",
          "status": "online",
          "busy": true,
          "labels": [
            {
              "id": 5,
              "name": "self-hosted",
              "type": "read-only"
            },
            {
              "id": 7,
      // etc...
    

    【讨论】:

    • 我要替换我公司的 repo 或类似的 'orgs' 或 'ORG' 吗?
    • 跑步者可以在组织级别或回购级别定义。假设您已在 org 级别安装它们,则替换 ORG。
    猜你喜欢
    • 1970-01-01
    • 2019-03-25
    • 2021-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 1970-01-01
    • 2012-11-06
    相关资源
    最近更新 更多