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

리포지토리 상호 작용에 대한 REST API 엔드포인트

REST API를 사용하면 퍼블릭 리포지토리에서 댓글을 달거나, 이슈를 열거나, 끌어오기 요청을 만들 수 있는 사용자 유형을 일시적으로 제한할 수 있습니다.

누가 이 기능을 사용할 수 있는 있나요?

People with owner or admin access to temporarily restrict which type of user can comment, open issues, or create pull requests in a public repository.

리포지토리 상호 작용 정보

소유자 또는 관리자 액세스 권한이 있는 사람은 REST API를 사용하여 공개 리포지토리에서 댓글을 달거나 이슈를 열거나 끌어오기 요청을 생성할 수 있는 사용자 유형을 일시적으로 제한할 수 있습니다. 제한을 사용하도록 설정하면 지정된 유형의 GitHub 사용자만 상호 작용에 참여할 수 있습니다. 제한은 정의된 기간 후에 자동으로 만료됩니다. GitHub 사용자 유형에 대한 자세한 내용은 다음과 같습니다.

  • 리포지토리의 기존 사용자: 상호 작용을 existing_users로 제한하면 이전에 기여하지 않고 협력자가 아니며 계정이 생성된 지 24시간 미만인 신규 사용자가 일시적으로 제한됩니다..
  • 리포지토리의 기여자만: 상호 작용을 contributors_only로 제한할 때 이전에 기여하지 않았으며 협력자도 아닌 사용자는 일시적으로 제한됩니다..
  • 리포지토리의 협력자만 해당: 상호 작용을 collaborators_only으로 제한하면 협력자가 아닌 사용자가 일시적으로 제한됩니다..

리포지토리를 소유하는 사용자 또는 조직에 대해 상호 작용 제한을 사용하는 경우 개별 리포지토리에 대한 제한을 변경할 수 없습니다. 대신 사용자 또는 조직 상호 작용 엔드포인트를 사용하여 상호 작용 제한을 변경합니다.

Get interaction restrictions for a repository

Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response.

"Get interaction restrictions for a repository"에 대한 세분화된 액세스 토큰

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

토큰에 다음 권한 집합이 있어야 합니다.:

  • administration:read

"Get interaction restrictions for a repository"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

"Get interaction restrictions for a repository"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

"Get interaction restrictions for a repository"에 대한 코드 샘플

요청 예제

get/repos/{owner}/{repo}/interaction-limits
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/interaction-limits

Response

Status: 200
{ "limit": "collaborators_only", "origin": "repository", "expires_at": "2018-08-17T04:18:39Z" }

Set interaction restrictions for a repository

Temporarily restricts interactions to a certain type of GitHub user within the given repository. You must have owner or admin access to set these restrictions. If an interaction limit is set for the user or organization that owns this repository, you will receive a 409 Conflict response and will not be able to use this endpoint to change the interaction limit for a single repository.

"Set interaction restrictions for a repository"에 대한 세분화된 액세스 토큰

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

토큰에 다음 권한 집합이 있어야 합니다.:

  • administration:write

"Set interaction restrictions for a repository"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

본문 매개 변수
이름, Type, 설명
limit string Required

The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect.

다음 중 하나일 수 있습니다.: existing_users, contributors_only, collaborators_only

expiry string

The duration of the interaction restriction. Default: one_day.

다음 중 하나일 수 있습니다.: one_day, three_days, one_week, one_month, six_months

"Set interaction restrictions for a repository"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

409

Conflict

"Set interaction restrictions for a repository"에 대한 코드 샘플

요청 예제

put/repos/{owner}/{repo}/interaction-limits
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/interaction-limits \ -d '{"limit":"collaborators_only","expiry":"one_day"}'

Response

Status: 200
{ "limit": "collaborators_only", "origin": "repository", "expires_at": "2018-08-17T04:18:39Z" }

Remove interaction restrictions for a repository

Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions. If the interaction limit is set for the user or organization that owns this repository, you will receive a 409 Conflict response and will not be able to use this endpoint to change the interaction limit for a single repository.

"Remove interaction restrictions for a repository"에 대한 세분화된 액세스 토큰

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

토큰에 다음 권한 집합이 있어야 합니다.:

  • administration:write

"Remove interaction restrictions for a repository"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

"Remove interaction restrictions for a repository"에 대한 HTTP 응답 상태 코드

상태 코드설명
204

No Content

409

Conflict

"Remove interaction restrictions for a repository"에 대한 코드 샘플

요청 예제

delete/repos/{owner}/{repo}/interaction-limits
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/interaction-limits

Response

Status: 204