Skip to main content
REST API はバージョン管理になりました。 詳細については、「API のバージョン管理について」を参照してください。

リポジトリ インタラクション用の REST API エンドポイント

この REST API を使って、パブリック リポジトリ内でコメントする、issue を開く、または pull request を作成することができるユーザーの種類を一時的に制限します。

この機能を使用できるユーザーについて

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 を使って、パブリック リポジトリ内でコメントする、issue を開く、または pull request を作成することができるユーザーの種類を一時的に制限することができます。 制限が有効化されると、指定した種類のGitHubユーザのみがインタラクションに参加できるようになります。 制限は、定義された期間の後に自動的に期限切れになります。 GitHub ユーザのタイプについては以下を参照してください。

  • リポジトリのExisting users(既存のユーザー): インタラクションを existing_users に制限すると、24 時間以下しか経過していないアカウントの新規ユーザーで、以前にコントリビューションしておらず、コラボレーターでもないユーザーは、一時的に制限されます。
  • リポジトリのContributors only (共同作成者のみ): 対話を contributors_only に制限すると、以前に投稿していない共同作成者ではないユーザーは一時的に制限されます
  • リポジトリのCollaborators only(コラボレーターのみ): インタラクションを collaborators_only に制限すると、コラボレーターではないユーザーは一時的に制限されます

リポジトリを所有しているユーザまたはOrganizationについてインタラクション制限を有効にしている場合、個々のリポジトリについてその制限を変更することはできません。 代わりに、User または Organization インタラクション エンドポイントを使って、インタラクションの制限を変更します。

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 必須

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

repo string 必須

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 必須

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

repo string 必須

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

本文のパラメーター
名前, Type, 説明
limit string 必須

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 必須

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

repo string 必須

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