Los usuarios interactuan con los repositorios al comentar, abrir informes de problemas y crear solicitudes de extracción. Las API de interacciones permiten a las personas con acceso adminsitrativo o de propietario resgringir temporalmente a usuarios específicos de la interacción con los repositorios públicos.
Organización
La API de Interacciones de la Organización permite a los propietarios de las organizaciones restringir temporalmente qué usuarios pueden comentar, abrir informes de problemas, o crear solicitudes de extracción en los repositorios públicos de la organización. Cuando se habilitan las restricciones, solo el grupo de usuarios de GitHub que hayas especificado podrá participar en las interacciones. Las restricciones caducan 24 horas después de la hora en la que se configuraron. Aquí tienes más detalles sobre los grupos de usuarios de GitHub:
-
Usuarios existentes: Cuando limitas las interacciones a
existing_users, se restringirá temporalmente a los usuarios nuevos con cuentas de menos de 24 horas que no hayan hecho contribuciones anteriormente y que no sean colaboradores en la organización. -
Solo para contribuyentes: Cuando limitas las interacciones para
contributors_only, se restringirá temporalmente a los usuarios que no hayan hecho contribuciones anteriormente y que no sean colaboradores en la organización. -
Solo para colaboradores: Cuando limitas las interacciones para
collaborators_only, se restringirá temporalmente a los usuarios que no sean colaboradores en la organización.Get interaction restrictions for an organization
Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response.
get /orgs/{org}/interaction-limitsParámetros
Name Type In Description acceptstring header Setting to
application/vnd.github.v3+jsonis recommended.orgstring path Ejemplos de código
Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/ORG/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('GET /orgs/{org}/interaction-limits', { org: 'org' })Response
Status: 200 OK{ "limit": "collaborators_only", "origin": "organization", "expires_at": "2018-08-17T04:18:39Z" }Notes
Set interaction restrictions for an organization
Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization.
put /orgs/{org}/interaction-limitsParámetros
Name Type In Description acceptstring header Setting to
application/vnd.github.v3+jsonis recommended.orgstring path limitstring body Required. 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:
existing_users,contributors_only,collaborators_only.expirystring body The duration of the interaction restriction. Can be one of:
one_day,three_days,one_week,one_month,six_months. Default:one_day.Ejemplos de código
Shell
curl \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/ORG/interaction-limits \ -d '{"limit":"limit"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /orgs/{org}/interaction-limits', { org: 'org', limit: 'limit' })Response
Status: 200 OK{ "limit": "collaborators_only", "origin": "organization", "expires_at": "2018-08-17T04:18:39Z" }Validation failed
Status: 422 Unprocessable EntityNotes
Remove interaction restrictions for an organization
Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions.
delete /orgs/{org}/interaction-limitsParámetros
Name Type In Description acceptstring header Setting to
application/vnd.github.v3+jsonis recommended.orgstring path Ejemplos de código
Shell
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/ORG/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('DELETE /orgs/{org}/interaction-limits', { org: 'org' })Response
Status: 204 No ContentNotes
Repositorio
La API de interacciones con el repositorio le permite a las personas con acceso administrativo o de propietario restringir temporalmente qué usuarios pueden comentar, abrir informes de problemas, o crear solicitudes de extracción en un repositorio público. Cuando se habilitan las restricciones, solo el grupo de usuarios de GitHub que hayas especificado podrá participar en las interacciones. Las restricciones caducan 24 horas después de la hora en la que se configuraron. Aquí tienes más detalles sobre los grupos de usuarios de GitHub:
- Usuarios existentes: Cuando limitas las interacciones a
existing_users, se restringirá temporalmente a los usuarios nuevos con cuentas de menos de 24 horas que no hayan hecho contribuciones anteriormente y que no sean colaboradores en el repositorio. - Solo para contribuyentes: Cuando limitas las interacciones para
contributors_only, se restringirá temporalmente a los usuarios que no hayan hecho contribuciones anteriormente y que no sean colaboradores en el repositorio. - Solo para colaboradores: Cuando limitas las interacciones para
collaborators_only, se restringirá temporalmente a los usuarios que no sean colaboradores en el repositorio.
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 /repos/{owner}/{repo}/interaction-limits
Parámetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
owner |
string | path | |
repo |
string | path |
Ejemplos de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world'
})
Response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Notes
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.
put /repos/{owner}/{repo}/interaction-limits
Parámetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
owner |
string | path | |
repo |
string | path | |
limit |
string | body |
Required. 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: |
expiry |
string | body |
The duration of the interaction restriction. Can be one of: |
Ejemplos de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/interaction-limits \
-d '{"limit":"limit"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world',
limit: 'limit'
})
Response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Response
Status: 409 Conflict
Notes
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.
delete /repos/{owner}/{repo}/interaction-limits
Parámetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
owner |
string | path | |
repo |
string | path |
Ejemplos de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('DELETE /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world'
})
Response
Status: 204 No Content
Response
Status: 409 Conflict