リポジトリのインタラクション
Repository interactions API を使用すると、オーナーまたは管理者アクセス権のあるユーザはパブリックリポジトリでコメント、Issueのオープン、プルリクエストの作成ができるユーザのタイプを一時的に制限することができます。
Repository interactions APIについて
Repository interactions API を使用すると、オーナーまたは管理者アクセス権のあるユーザはパブリックリポジトリでコメント、Issueのオープン、プルリクエストの作成ができるユーザのタイプを一時的に制限することができます。 制限が有効化されると、指定した種類のGitHubユーザのみがインタラクションに参加できるようになります。 制限は、定義された期間の後に自動的に期限切れになります。 GitHub ユーザのタイプについては以下を参照してください。
- リポジトリのExisting users(既存のユーザ): インタラクションを
existing_usersに制限すると、24時間以下しか経過していないアカウントの新規ユーザで、以前にコントリビューションしておらず、コラボレーターでもないユーザは、一時的に制限されます。 - リポジトリのContributors only(コントリビューターのみ):インタラクションを
contributors_onlyに制限すると、以前にコントリビューションしておらず、コラボレーターでもないユーザは一時的に制限されます。 - リポジトリのCollaborators only(コラボレーターのみ): インタラクションを
collaborators_onlyに制限すると、コラボレーターではないユーザは、一時的に制限されます。
リポジトリを所有しているユーザまたはOrganizationについてインタラクション制限を有効にしている場合、個々のリポジトリについてその制限を変更することはできません。 インタラクション制限を変更するには、ユーザまたは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 |
|---|
| 名前, 種類, 説明 |
acceptstringSetting to |
| Path parameters |
| 名前, 種類, 説明 |
ownerstring必須The account owner of the repository. The name is not case sensitive. |
repostring必須The name of the repository. The name is not case sensitive. |
HTTP response status codes
| Status code | 説明 |
|---|---|
200 | OK |
コードサンプル
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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 |
|---|
| 名前, 種類, 説明 |
acceptstringSetting to |
| Path parameters |
| 名前, 種類, 説明 |
ownerstring必須The account owner of the repository. The name is not case sensitive. |
repostring必須The name of the repository. The name is not case sensitive. |
| Body parameters |
| 名前, 種類, 説明 |
limitstring必須The 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 response status codes
| Status code | 説明 |
|---|---|
200 | OK |
409 | Conflict |
コードサンプル
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limitsResponse
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 |
|---|
| 名前, 種類, 説明 |
acceptstringSetting to |
| Path parameters |
| 名前, 種類, 説明 |
ownerstring必須The account owner of the repository. The name is not case sensitive. |
repostring必須The name of the repository. The name is not case sensitive. |
HTTP response status codes
| Status code | 説明 |
|---|---|
204 | No Content |
409 | Conflict |
コードサンプル
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limitsResponse
Status: 204