リポジトリ インタラクション
リポジトリ インタラクション API を使うと、所有者または管理者のアクセス権を持つユーザーは、パブリック リポジトリでコメントしたり、issue を開いたり、pull request を作成したりできるユーザーの種類を、一時的に制限することができます。
リポジトリ インタラクション API について
リポジトリ インタラクション 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.
パラメーター
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
ownerstringRequiredThe account owner of the repository. The name is not case sensitive. |
repostringRequiredThe name of the repository. The name is not case sensitive. |
HTTP 応答状態コード
| status code | 説明 |
|---|---|
200 | OK |
コード サンプル
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limitsResponse
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.
パラメーター
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
ownerstringRequiredThe account owner of the repository. The name is not case sensitive. |
repostringRequiredThe name of the repository. The name is not case sensitive. |
| Body parameters |
| Name, Type, Description |
limitstringRequiredThe type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: |
expirystringThe duration of the interaction restriction. Default: Can be one of: |
HTTP 応答状態コード
| status code | 説明 |
|---|---|
200 | OK |
409 | Conflict |
コード サンプル
curl \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
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.
パラメーター
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
ownerstringRequiredThe account owner of the repository. The name is not case sensitive. |
repostringRequiredThe name of the repository. The name is not case sensitive. |
HTTP 応答状態コード
| status code | 説明 |
|---|---|
204 | No Content |
409 | Conflict |
コード サンプル
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limitsResponse
Status: 204