Skip to main content
이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

규칙 도구 모음에 대한 REST API 엔드포인트

REST API를 사용하여 조직의 규칙 모음을 관리합니다.

List organization rule suites

Lists suites of rule evaluations at the organization level. For more information, see "Managing rulesets for repositories in your organization."

"List organization rule suites"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Administration" organization permissions (write)

"List organization rule suites"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
org string Required

The organization name. The name is not case sensitive.

쿼리 매개 변수
속성, 형식, 설명
ref string

The name of the ref. Cannot contain wildcard characters. When specified, only rule evaluations triggered for this ref will be returned.

repository_name integer

The name of the repository to filter on. When specified, only rule evaluations from this repository will be returned.

time_period string

The time period to filter by.

For example, day will filter for rule suites that occurred in the past 24 hours, and week will filter for insights that occurred in the past 7 days (168 hours).

기본값: day

다음 중 하나일 수 있습니다.: hour, day, week, month

actor_name string

The handle for the GitHub user account to filter on. When specified, only rule evaluations triggered by this actor will be returned.

rule_suite_result string

The rule results to filter on. When specified, only suites with this result will be returned.

기본값: all

다음 중 하나일 수 있습니다.: pass, fail, bypass, all

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"List organization rule suites"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

404

Resource not found

500

Internal Error

"List organization rule suites"에 대한 코드 샘플

요청 예제

get/orgs/{org}/rulesets/rule-suites
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/rulesets/rule-suites

Response

Status: 200
[ { "id": 21, "actor_id": 12, "actor_name": "octocat", "before_sha": "893f768e172fb1bc9c5d6f3dd48557e45f14e01d", "after_sha": "dedd88641a362b6b4ea872da4847d6131a164d01", "ref": "refs/heads/i-see-everything", "repository_id": 404, "repository_name": "octo-repo", "pushed_at": "2023-07-06T08:43:03Z", "result": "bypass" }, { "id": 25, "actor_id": 11, "actor_name": "not-octocat", "before_sha": "48994e4e01ccc943624c6231f172702b82b233cc", "after_sha": "ecfd5a1025fa271a33ca5608d089476a2df3c9a1", "ref": "refs/heads/i-am-everything", "repository_id": 404, "repository_name": "octo-repo", "pushed_at": "2023-07-07T08:43:03Z", "result": "pass", "evaluation_result": "fail" } ]

Get an organization rule suite

Gets information about a suite of rule evaluations from within an organization. For more information, see "Managing rulesets for repositories in your organization."

"Get an organization rule suite"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Administration" organization permissions (write)

"Get an organization rule suite"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
org string Required

The organization name. The name is not case sensitive.

rule_suite_id integer Required

The unique identifier of the rule suite result. To get this ID, you can use GET /repos/{owner}/{repo}/rulesets/rule-suites for repositories and GET /orgs/{org}/rulesets/rule-suites for organizations.

"Get an organization rule suite"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

404

Resource not found

500

Internal Error

"Get an organization rule suite"에 대한 코드 샘플

요청 예제

get/orgs/{org}/rulesets/rule-suites/{rule_suite_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/rulesets/rule-suites/RULE_SUITE_ID

Response

Status: 200
{ "id": 21, "actor_id": 12, "actor_name": "octocat", "before_sha": "893f768e172fb1bc9c5d6f3dd48557e45f14e01d", "after_sha": "dedd88641a362b6b4ea872da4847d6131a164d01", "ref": "refs/heads/i-see-everything", "repository_id": 404, "repository_name": "octo-repo", "pushed_at": "2023-07-06T08:43:03Z", "result": "bypass", "evaluation_result": "fail", "rule_evaluations": [ { "rule_source": { "type": "ruleset", "id": 2, "name": "Author email must be a GitHub email address" }, "enforcement": "active", "result": "pass", "rule_type": "commit_author_email_pattern" }, { "rule_source": { "type": "protected_branch" }, "enforcement": "active", "result": "fail", "rule_type": "pull_request", "details": "Changes must be made through a pull request." }, { "rule_source": { "type": "ruleset", "id": 3, "name": "Evaluate commit message pattern" }, "enforcement": "evaluate", "result": "fail", "rule_type": "commit_message_pattern" } ] }