此版本的 GitHub Enterprise 已停止服务 2023-03-15. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持。
自定义存储库角色
使用 REST API 与自定义存储库角色交互。
List custom repository roles in an organization
List the custom repository roles available in this organization. In order to see custom repository roles in an organization, the authenticated user must be an organization owner.
To use this endpoint the authenticated user must be an administrator for the organization or of an repository of the organization and must use an access token with admin:org repo
scope.
GitHub Apps must have the organization_custom_roles:read
organization permission to use this endpoint.
For more information on custom repository roles, see "About custom repository roles."
“List custom repository roles in an organization”的参数
标头 |
---|
名称, 类型, 说明 |
accept string Setting to |
路径参数 |
名称, 类型, 说明 |
organization_id string 必须The unique identifier of the organization. |
“List custom repository roles in an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Response - list of custom role names |
“List custom repository roles in an organization”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/organizations/ORGANIZATION_ID/custom_roles
Response - list of custom role names
Status: 200
{
"total_count": 2,
"custom_roles": [
{
"id": 8030,
"name": "Developer"
},
{
"id": 8031,
"name": "Designer"
}
]
}