Skip to main content

Configuring custom deployment protection rules

Use GitHub Apps to automate protecting deployments with third-party systems.

¿Quién puede utilizar esta característica?

Las reglas de protección de implementación personalizadas están disponibles en repositorios públicos para todos los planes. Para acceder a otras reglas de protección de implementación personalizadas en los repositorios privados o internos, debes utilizar GitHub Enterprise.

Nota:

Las reglas de protección de implementación personalizadas se encuentran actualmente en versión preliminar pública y están sujetas a cambios.

About custom deployment protection rules

Custom deployment protection rules are powered by GitHub Apps. Once a deployment protection rule is configured and installed in a repository, it can be enabled for any environments in the repository.

After you enable a custom deployment protection rule on an environment, every time a workflow step targets that environment, the deployment protection rule will run automatically. For more information about targeting an environment for deployments, see Managing environments for deployment.

When a custom deployment protection rule is triggered it will wait for up to 30 days for a webhook event response before it times out and the workflow job fails.

For more information about creating your own custom deployment protection rules, see Creating custom deployment protection rules.

Nota:

Se puede instalar en un repositorio cualquier número de reglas de protección de implementación basadas en GitHub Apps. Sin embargo, se puede habilitar un máximo de 6 reglas de protección de implementación en cualquier entorno al mismo tiempo.

Using existing custom deployment protection rules

You can choose to create your own custom deployment protection rules or you may use any existing custom deployment protection rules.

The following is a list of official partner implementations for deployment protection rules.

Prerequisites

In order for a custom deployment protection rule to be available to all environments in a repository, you must first install the custom deployment protection rule on the repository. For more information, see Instalación de tu propia instancia de GitHub App.

After a custom deployment protection rule has been installed in a repository, it must be enabled for each environment where you want the rule to apply.

Enabling custom deployment protection rules for the environment

  1. En GitHub, navegue hasta la página principal del repositorio.

  2. En el nombre del repositorio, haz clic en Configuración. Si no puedes ver la pestaña "Configuración", selecciona el menú desplegable y, a continuación, haz clic en Configuración.

    Captura de pantalla de un encabezado de repositorio en el que se muestran las pestañas. La pestaña "Configuración" está resaltada con un contorno naranja oscuro.

  3. En la barra lateral de la izquierda, haz clic en Entornos.

  4. Select the environment you want to configure.

  5. Under "Deployment protection rules," check the box next to each custom deployment protection rule you want to enable for the environment.

  6. Click Save protection rules.

Once a custom deployment protection rule has been enabled for an environment, it will automatically run whenever a workflow reaches a job that references the environment. You can see the results of an approval or rejection for your deployment by reviewing the details of the deployment. For more information, see Reviewing deployments.