Información sobre las políticas de Actions
Las directivas de acciones permiten controlar cómo GitHub Actions se ejecutan los flujos de trabajo en las organizaciones y repositorios. Las directivas de acciones se configuran en una nueva sección Directivas de la GitHub Actions configuración, independiente de la configuración general existente.
Las directivas de acciones están disponibles en los niveles de empresa, organización y repositorio.
Las directivas de acciones contienen actualmente un tipo de directiva: protecciones de ejecución de flujo de trabajo. GitHub planea agregar más directivas a lo largo del tiempo.
Acerca de las protecciones de ejecución de flujo de trabajo
Las protecciones de ejecución de flujo de trabajo permiten definir una lista de permitidos que controla quién puede desencadenar GitHub Actions flujos de trabajo y qué eventos pueden ejecutarlos. Las protecciones de ejecución de flujo de trabajo incluyen dos tipos de reglas: evento y actor. GitHub planea agregar más reglas a lo largo del tiempo.
Las protecciones para la ejecución de flujos de trabajo se basan en el marco de conjuntos de reglas GitHub, por lo que la segmentación que ya conoces de los conjuntos de reglas también se aplica aquí. Puede aplicar protecciones con conjuntos de reglas y limitarlas a repositorios específicos mediante propiedades personalizadas del repositorio. Para obtener más información sobre los conjuntos de reglas, consulte Acerca de los conjuntos de reglas. For more information, see About Actions policies.
Nota:
GitHub has added a default policy that will block the pull_request_target event in public repositories. This policy will be enforced on November 2, 2026. See Uso seguro de pull_request_target.
Preparing to add protections
Like rulesets, workflow execution protections layer with other protections in the same repository, organization, or enterprise.
Rather than creating one large policy per account, we recommend creating multiple clearly defined policies and layering protections across account levels. Enterprise owners can create protections at the enterprise level for broad, non-negotiable policies. Organization owners and repository administrators can then add to these restrictions.
For each policy you define, think about:
-
Which organizations or repositories your protection will target. For example, open source repositories may need tighter restrictions on who can trigger workflows. You can target repositories by factors like visibility, deployment status, or custom property.
- Deployment status comes from an organization's linked artifacts page. If this is an important factor, make sure you're uploading deployment records when an artifact is deployed. See Acerca de los artefactos vinculados.
- To create and assign custom properties, see Administración de propiedades personalizadas para repositorios de la organización.
-
Which workflows will be protected. For example, workflows that deploy production code might need a certain level of protection, but less sensitive automations may not need the same level of protection. You can scope policies to specific workflow paths or required workflows.
-
Who should be able to run these workflows in the repositories you're targeting. This might be users with a certain role, selected bot accounts, or a specific team. Consider grouping these users in an organization or enterprise team so they can be easily contacted and referenced across multiple rulesets. See Creación de un equipo de organización or Creación de equipos empresariales.
Creating a workflow execution policy
First, create a new Actions policy for the account level you're working at.
In a repository or organization:
- Click the Settings tab.
- In the left sidebar, under Actions, click Policies.
In an enterprise:
- Click the Policies tab.
- In the left sidebar, click Actions, then Policies.
Sugerencia
To manage policies programmatically, see REST API endpoints for GitHub Actions policies.
Configuring the policy
Next, create a new policy.
- Choose a name for the policy.
- Choose an enforcement status. If you select Evaluate (GitHub Enterprise Cloud only), you will be able to monitor when users would hit the restriction in policy insights.
- Target your desired workflows, organizations, or repositories.
- Configure the following workflow execution protections.
Restrict actors
By default, every user with write access to a repository can trigger workflows. Actor rules let you separate who contributes code from who runs your CI, so you can grant a contributor write access without granting them the ability to execute workflows.
Only the allowed actors will be able to run the specified workflows in the targeted repository. If you also restrict events, these users will only be able to trigger workflows with the allowed events. Non-allowed actors will not be able to run the specified workflows at all.
GitHub features are exempt from these restrictions for the built-in processes that they run on GitHub Actions. However, if you have created workflows that need to be run by the identity associated with a GitHub feature, such as dependabot[bot], then this identity must be added as an allowed actor.
Restrict events
Event rules control which events are permitted, such as push, pull_request, pull_request_target, and workflow_dispatch.
Evaluating policies
You can view policy insights to see workflow runs that have been blocked (for active policies) or would have been blocked (for "evaluate" policies). This is a good way to check that policies are working as intended and not causing unnecessary friction.
To view insights, click the Policy insights page. You'll find this directly under the page for GitHub Actions policies in your repository, organization, or enterprise sidebar.