Closed
feat(actions): 支持 获取指定 Runner Group 的详细信息 API #435
aflyingtoAdd on  Jul 9Closed at  Jul 13
aflyingtoCollaborators
Jul 9 Create

背景

GitCode API 文档 2.0.0 已提供 Actions API。该 Issue 用于跟踪 gitcode-cli 对此接口的支持设计与实现。

API 摘要

  • 标题: 获取指定 Runner Group 的详细信息
  • Method: GET
  • Path: /api/v8/orgs/{org}/actions/runner-groups/{runner_group_id}
  • Operation ID: get_api_v8_orgs_{org}_actions_runner_groups_{runner_group_id}
  • Tags: pipeline-v8
  • Deprecated: false
  • Description: 无

Request Parameters

Name In Required Type Description
org path yes string 组织path
runner_group_id path yes string
access_token query yes string

Request Body

无。

Responses

200

  • Description: (empty)
  • Headers: 无
  • Content-Types: application/json

application/json schema

{
  "type": "object",
  "properties": {
    "runner_group_id": {
      "type": "string",
      "description": "Runner Group ID"
    },
    "runner_group_name": {
      "type": "string",
      "description": "Runner Group 名称"
    },
    "share_all": {
      "type": "boolean",
      "description": "是否分享给全部仓库"
    },
    "share_all_public_repos": {
      "type": "boolean",
      "description": "是否分享给全部公开仓库"
    },
    "explicit_shared_repo_count": {
      "type": "integer",
      "description": "显式分享仓库数量"
    },
    "created_at": {
      "type": "integer",
      "description": "创建时间"
    },
    "updated_at": {
      "type": "integer",
      "description": "更新时间"
    }
  },
  "description": "com.gitcode.openapi.pojo.action.runner.BizRunnerGroupDetailResp"
}

原始 OpenAPI Operation

{
  "deprecated": false,
  "description": "",
  "operationId": "get_api_v8_orgs_{org}_actions_runner_groups_{runner_group_id}",
  "tags": [
    "pipeline-v8"
  ],
  "parameters": [
    {
      "name": "org",
      "in": "path",
      "description": "组织path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "runner_group_id",
      "in": "path",
      "description": "",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "access_token",
      "in": "query",
      "description": "",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "runner_group_id": {
                "type": "string",
                "description": "Runner Group ID"
              },
              "runner_group_name": {
                "type": "string",
                "description": "Runner Group 名称"
              },
              "share_all": {
                "type": "boolean",
                "description": "是否分享给全部仓库"
              },
              "share_all_public_repos": {
                "type": "boolean",
                "description": "是否分享给全部公开仓库"
              },
              "explicit_shared_repo_count": {
                "type": "integer",
                "description": "显式分享仓库数量"
              },
              "created_at": {
                "type": "integer",
                "description": "创建时间"
              },
              "updated_at": {
                "type": "integer",
                "description": "更新时间"
              }
            },
            "description": "com.gitcode.openapi.pojo.action.runner.BizRunnerGroupDetailResp"
          }
        }
      },
      "headers": {}
    }
  },
  "security": [],
  "method": "get",
  "path": "/api/v8/orgs/{org}/actions/runner-groups/{runner_group_id}",
  "servers": [
    {
      "url": "https://api.gitcode.com",
      "description": "正式环境"
    }
  ],
  "securitySchemes": {},
  "info": {
    "title": "GicodeOpenAPI",
    "description": "",
    "version": "1.0.0"
  },
  "postman": {
    "name": "获取指定 Runner Group 的详细信息",
    "description": {
      "content": "",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "api",
        "v8",
        "orgs",
        ":org",
        "actions",
        "runner-groups",
        ":runner_group_id"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) ",
            "type": "text/plain"
          },
          "key": "access_token",
          "value": ""
        }
      ],
      "variable": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) 组织path",
            "type": "text/plain"
          },
          "type": "any",
          "value": "",
          "key": "org"
        },
        {
          "disabled": false,
          "description": {
            "content": "(Required) ",
            "type": "text/plain"
          },
          "type": "any",
          "value": "",
          "key": "runner_group_id"
        }
      ]
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET"
  }
}

初步验收建议

  • 增加对应 API client/query 方法,保留 v8 路径。
  • 设计 agent-friendly 的 CLI 命令、帮助文本、JSON 输出和错误处理。
  • 单元测试覆盖参数映射、响应解析和错误路径。
  • 如做真实命令验证,只能使用 infra-test/* 仓库。
  • 不暴露或打印 token;文档中的 access_token 仅作为 API 参数记录,CLI 优先复用现有认证机制。
likedislike
AaflyingtoCollaborators
Jul 9 Added label: risk/mediumscope/api, status/triage,type/feature
AaflyingtoCollaborators
Jul 9 Associated milestone: Actions M3: Runner 管理
AaflyingtoCollaborators
Jul 9 Added label: featurescope/actions
AaflyingtoCollaborators
Jul 9 Removed label: feature
aflyingtoCollaborators
Jul 13 Comments:

验证记录

  • 当前版本或分支: main @ 6def178(gc 0.7.0+)
  • 验证方式: 通过 gc api 直接调用 API 端点确认可达
  • 复现命令: gc api --method GET "/api/v8/orgs/infra-test/actions/runner-groups/nonexistent-rg-id"
  • 实际结果: HTTP 404 Runner Group not found: nonexistent-rg-id — API 端点可达,对不存在的 runner group id 返回 404(预期)
  • API 规格: GET /api/v8/orgs/{org}/actions/runner-groups/{runner_group_id},返回 RunnerGroupDetail(runner_group_id/runner_group_name/share_all/share_all_public_repos/explicit_shared_repo_count/created_at/updated_at)
  • 结论: 需求有效,API 可达,进入修复
likedislike
AaflyingtoCollaborators
Jul 13 Removed label: status/triage
AaflyingtoCollaborators
Jul 13 Added label: status/verified
AaflyingtoCollaborators
Jul 13 Added label: status/in-progress
AaflyingtoCollaborators
Jul 13 Associated pull request
AaflyingtoCollaborators
Jul 13 Close issue
AaflyingtoCollaborators
Jul 13 Removed label: status/in-progress
AaflyingtoCollaborators
Jul 13 Removed label: status/verified
AaflyingtoCollaborators
Jul 13 Added label: status/merged