Interacciones de los repositorios
Usa la API REST para restringir temporalmente qué tipo de usuario puede comentar, abrir incidencias o crear solicitudes de incorporación de cambios en un repositorio público.
Acerca de las interacciones del repositorio
Las personas con acceso administrativo o de propietario pueden usar la API REST para restringir temporalmente qué tipo de usuario puede comentar, abrir incidencias o crear solicitudes de incorporación de cambios en un repositorio público. Cuando se habilitan las restricciones, solo el tipo de usuario de GitHub Enterprise Cloud que hayas especificado podrá participar en las interacciones. Las restricciones expiran automáticamente después de una duración definida. Aquí puedes aprender más sobre los tipos de usuario de GitHub Enterprise Cloud:
- Usuarios existentes: al limitar las interacciones a
existing_users
, los nuevos usuarios con cuentas con menos de 24 horas de antigüedad que no hayan contribuido previamente y no sean colaboradores se restringirán temporalmente. en el repositorio. - Solo colaboradores: cuando limita las interacciones a
contributors_only
, se restringe temporalmente a los usuarios que no han contribuido previamente y no son colaboradores. en el repositorio. - Solo colaboradores: al limitar las interacciones a
collaborators_only
, los usuarios que no son colaboradores se restringirán temporalmente. en el repositorio.
Si se habilita un límite de interacción para el usuario u organización a la que pertenece el repositorio, éste no podrá cambiarse para el repositorio individual. En su lugar, use los puntos de conexión de interacciones de usuario u organización para cambiar el límite de interacción.
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.
Parámetros para "Get interaction restrictions for a repository"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository without the |
Códigos de estado de respuesta HTTP para "Get interaction restrictions for a repository"
status code | Descripción |
---|---|
200 | OK |
Ejemplos de código para "Get interaction restrictions for a repository"
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.
Parámetros para "Set interaction restrictions for a repository"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository without the |
Nombre, Tipo, Descripción |
---|
limit string RequeridoThe type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Puede ser uno de los siguientes: |
expiry string The duration of the interaction restriction. Default: Puede ser uno de los siguientes: |
Códigos de estado de respuesta HTTP para "Set interaction restrictions for a repository"
status code | Descripción |
---|---|
200 | OK |
409 | Conflict |
Ejemplos de código para "Set interaction restrictions for a repository"
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.
Parámetros para "Remove interaction restrictions for a repository"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository without the |
Códigos de estado de respuesta HTTP para "Remove interaction restrictions for a repository"
status code | Descripción |
---|---|
204 | No Content |
409 | Conflict |
Ejemplos de código para "Remove interaction restrictions for a repository"
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