REST API endpoints for GitHub Actions policies
Use the REST API to view and manage policies for GitHub Actions.
List organization Actions policies
List all Actions policies for an organization.
Tokens de acesso granulares para "List organization Actions policies"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" organization permissions (write)
Parâmetros para "List organization Actions policies"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
| Nome, Tipo, Descrição |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
has_parents boolean Include policies configured at higher levels that apply to this organization Padrão: |
Códigos de status de resposta HTTP para "List organization Actions policies"
| Código de status | Descrição |
|---|---|
200 | OK |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "List organization Actions policies"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/actions/policiesResponse
Status: 200{
"total_count": 2,
"policies": [
{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"node_id": "RUL_lA",
"_links": {
"self": {
"href": "https://api.github.com/enterprises/enterprise/actions/policies/1"
},
"html": {
"href": "https://github.com/enterprises/enterprise/settings/policies/actions/1"
}
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"name": "Restrict workflow events",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "evaluate",
"node_id": "RUL_lB",
"_links": {
"self": {
"href": "https://api.github.com/enterprises/enterprise/actions/policies/2"
},
"html": {
"href": "https://github.com/enterprises/enterprise/settings/policies/actions/2"
}
},
"created_at": "2024-01-15T11:00:00Z",
"updated_at": "2024-01-15T11:00:00Z"
}
]
}Create an organization Actions policy
Create an Actions policy for an organization.
Omitting workflow_path targets all workflows without storing an explicit condition.
Tokens de acesso granulares para "Create an organization Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" organization permissions (write)
Parâmetros para "Create an organization Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
| Nome, Tipo, Descrição | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name string ObrigatórioThe name of the policy. | ||||||||||||||||||||||||||||||||||||||||||||||||||
enforcement string ObrigatórioThe enforcement level of the ruleset. Pode ser um dos: | ||||||||||||||||||||||||||||||||||||||||||||||||||
conditions object Conditions for an organization Actions policy. The conditions object should contain one of
| ||||||||||||||||||||||||||||||||||||||||||||||||||
Can be one of these objects:
workflow_path object Properties of |
| Nome, Tipo, Descrição |
|---|
include array of strings ObrigatórioArray of workflow file paths or glob patterns to include. An empty array includes all
workflows not matched by an excluded pattern. Use |
exclude array of strings ObrigatórioArray of workflow file paths or glob patterns to exclude. The condition will not pass
if any of these patterns match. |
Repository ruleset conditions for repository IDs object Parameters for a repository ID condition
Properties of Repository ruleset conditions for repository IDs
| Nome, Tipo, Descrição | |||
|---|---|---|---|
repository_id object Obrigatório | |||
Properties of |
| Nome, Tipo, Descrição |
|---|
repository_ids array of integers The repository IDs that the ruleset applies to. One of these IDs must match for the condition to pass. |
workflow_path object Properties of workflow_path
| Nome, Tipo, Descrição |
|---|
include array of strings ObrigatórioArray of workflow file paths or glob patterns to include. An empty array includes all
workflows not matched by an excluded pattern. Use |
exclude array of strings ObrigatórioArray of workflow file paths or glob patterns to exclude. The condition will not pass
if any of these patterns match. |
Repository ruleset conditions for repository properties object Parameters for a repository property condition
Properties of Repository ruleset conditions for repository properties
| Nome, Tipo, Descrição | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
repository_property object Obrigatório | |||||||||||||
Properties of |
| Nome, Tipo, Descrição | ||||
|---|---|---|---|---|
include array of objects The repository properties and values to include. All of these properties must match for the condition to pass. | ||||
Properties of |
| Nome, Tipo, Descrição |
|---|
name string ObrigatórioThe name of the repository property to target |
property_values array of strings ObrigatórioThe values to match for the repository property |
source string The source of the repository property. Defaults to 'custom' if not specified. Pode ser um dos: |
exclude array of objects The repository properties and values to exclude. The condition will not pass if any of these properties match.
Properties of exclude
| Nome, Tipo, Descrição |
|---|
name string ObrigatórioThe name of the repository property to target |
property_values array of strings ObrigatórioThe values to match for the repository property |
source string The source of the repository property. Defaults to 'custom' if not specified. Pode ser um dos: |
workflow_path object Properties of workflow_path
| Nome, Tipo, Descrição |
|---|
include array of strings ObrigatórioArray of workflow file paths or glob patterns to include. An empty array includes all
workflows not matched by an excluded pattern. Use |
exclude array of strings ObrigatórioArray of workflow file paths or glob patterns to exclude. The condition will not pass
if any of these patterns match. |
rules array of objects An array of rules within the policy.
Can be one of these objects:
| Nome, Tipo, Descrição | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
restrict_actions_actors object Choose specific actors that are authorized to trigger Actions workflows. | ||||||||||
Properties of |
| Nome, Tipo, Descrição | ||||||
|---|---|---|---|---|---|---|
type string ObrigatórioValor: | ||||||
parameters object | ||||||
Properties of |
| Nome, Tipo, Descrição | |||
|---|---|---|---|
allowed_actors array of objects ObrigatórioSelect the actors who can run Actions workflows. | |||
Properties of |
| Nome, Tipo, Descrição |
|---|
id integer ObrigatórioID of the actor authorized to trigger Actions workflows. |
type string ObrigatórioThe type of the actor Pode ser um dos: |
restrict_action_events object Choose specific GitHub events that will trigger Actions workflows.
Properties of restrict_action_events
| Nome, Tipo, Descrição | ||
|---|---|---|
type string ObrigatórioValor: | ||
parameters object | ||
Properties of |
| Nome, Tipo, Descrição |
|---|
allowed_events array of strings ObrigatórioSelect the events that can trigger Actions workflows.
Supported values are: |
Códigos de status de resposta HTTP para "Create an organization Actions policy"
| Código de status | Descrição |
|---|---|
201 | Created |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
Exemplos de código para "Create an organization Actions policy"
Exemplo de solicitação
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/actions/policies \
-d '{"name":"Require approved actors","enforcement":"active","rules":[{"type":"restrict_actions_actors","parameters":{"allowed_actors":[{"id":1234,"type":"Team"}]}}]}'Response
Status: 201{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"conditions": {
"organization_name": {
"include": [
"octo-org"
],
"exclude": []
},
"repository_name": {
"include": [
"octo-repo"
],
"exclude": []
}
},
"rules": [
{
"type": "restrict_actions_actors",
"parameters": {
"allowed_actors": [
{
"id": 5,
"type": "User"
},
{
"id": 1234,
"type": "Team"
}
]
}
}
],
"node_id": "RUL_lA",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Get an organization Actions policy
Get a specific Actions policy for an organization.
Tokens de acesso granulares para "Get an organization Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" organization permissions (write)
Parâmetros para "Get an organization Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
policy_id integer ObrigatórioThe ID of the policy. |
Códigos de status de resposta HTTP para "Get an organization Actions policy"
| Código de status | Descrição |
|---|---|
200 | OK |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "Get an organization Actions policy"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/actions/policies/POLICY_IDResponse
Status: 200{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"conditions": {
"organization_name": {
"include": [
"octo-org"
],
"exclude": []
},
"repository_name": {
"include": [
"octo-repo"
],
"exclude": []
}
},
"rules": [
{
"type": "restrict_actions_actors",
"parameters": {
"allowed_actors": [
{
"id": 5,
"type": "User"
},
{
"id": 1234,
"type": "Team"
}
]
}
}
],
"node_id": "RUL_lA",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Update an organization Actions policy
Update an Actions policy for an organization.
Omitting workflow_path preserves the policy's existing workflow targeting.
Tokens de acesso granulares para "Update an organization Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" organization permissions (write)
Parâmetros para "Update an organization Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
policy_id integer ObrigatórioThe ID of the policy. |
| Nome, Tipo, Descrição | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name string The name of the policy. | ||||||||||||||||||||||||||||||||||||||||||||||||||
enforcement string The enforcement level of the ruleset. Pode ser um dos: | ||||||||||||||||||||||||||||||||||||||||||||||||||
conditions object Conditions for an organization Actions policy. The conditions object should contain one of
| ||||||||||||||||||||||||||||||||||||||||||||||||||
Can be one of these objects:
workflow_path object Properties of |
| Nome, Tipo, Descrição |
|---|
include array of strings ObrigatórioArray of workflow file paths or glob patterns to include. An empty array includes all
workflows not matched by an excluded pattern. Use |
exclude array of strings ObrigatórioArray of workflow file paths or glob patterns to exclude. The condition will not pass
if any of these patterns match. |
Repository ruleset conditions for repository IDs object Parameters for a repository ID condition
Properties of Repository ruleset conditions for repository IDs
| Nome, Tipo, Descrição | |||
|---|---|---|---|
repository_id object Obrigatório | |||
Properties of |
| Nome, Tipo, Descrição |
|---|
repository_ids array of integers The repository IDs that the ruleset applies to. One of these IDs must match for the condition to pass. |
workflow_path object Properties of workflow_path
| Nome, Tipo, Descrição |
|---|
include array of strings ObrigatórioArray of workflow file paths or glob patterns to include. An empty array includes all
workflows not matched by an excluded pattern. Use |
exclude array of strings ObrigatórioArray of workflow file paths or glob patterns to exclude. The condition will not pass
if any of these patterns match. |
Repository ruleset conditions for repository properties object Parameters for a repository property condition
Properties of Repository ruleset conditions for repository properties
| Nome, Tipo, Descrição | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
repository_property object Obrigatório | |||||||||||||
Properties of |
| Nome, Tipo, Descrição | ||||
|---|---|---|---|---|
include array of objects The repository properties and values to include. All of these properties must match for the condition to pass. | ||||
Properties of |
| Nome, Tipo, Descrição |
|---|
name string ObrigatórioThe name of the repository property to target |
property_values array of strings ObrigatórioThe values to match for the repository property |
source string The source of the repository property. Defaults to 'custom' if not specified. Pode ser um dos: |
exclude array of objects The repository properties and values to exclude. The condition will not pass if any of these properties match.
Properties of exclude
| Nome, Tipo, Descrição |
|---|
name string ObrigatórioThe name of the repository property to target |
property_values array of strings ObrigatórioThe values to match for the repository property |
source string The source of the repository property. Defaults to 'custom' if not specified. Pode ser um dos: |
workflow_path object Properties of workflow_path
| Nome, Tipo, Descrição |
|---|
include array of strings ObrigatórioArray of workflow file paths or glob patterns to include. An empty array includes all
workflows not matched by an excluded pattern. Use |
exclude array of strings ObrigatórioArray of workflow file paths or glob patterns to exclude. The condition will not pass
if any of these patterns match. |
rules array of objects An array of rules within the policy.
Can be one of these objects:
| Nome, Tipo, Descrição | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
restrict_actions_actors object Choose specific actors that are authorized to trigger Actions workflows. | ||||||||||
Properties of |
| Nome, Tipo, Descrição | ||||||
|---|---|---|---|---|---|---|
type string ObrigatórioValor: | ||||||
parameters object | ||||||
Properties of |
| Nome, Tipo, Descrição | |||
|---|---|---|---|
allowed_actors array of objects ObrigatórioSelect the actors who can run Actions workflows. | |||
Properties of |
| Nome, Tipo, Descrição |
|---|
id integer ObrigatórioID of the actor authorized to trigger Actions workflows. |
type string ObrigatórioThe type of the actor Pode ser um dos: |
restrict_action_events object Choose specific GitHub events that will trigger Actions workflows.
Properties of restrict_action_events
| Nome, Tipo, Descrição | ||
|---|---|---|
type string ObrigatórioValor: | ||
parameters object | ||
Properties of |
| Nome, Tipo, Descrição |
|---|
allowed_events array of strings ObrigatórioSelect the events that can trigger Actions workflows.
Supported values are: |
Códigos de status de resposta HTTP para "Update an organization Actions policy"
| Código de status | Descrição |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
Exemplos de código para "Update an organization Actions policy"
Exemplo de solicitação
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/actions/policies/POLICY_ID \
-d '{"name":"Updated policy name","enforcement":"active"}'Response
Status: 200{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"conditions": {
"organization_name": {
"include": [
"octo-org"
],
"exclude": []
},
"repository_name": {
"include": [
"octo-repo"
],
"exclude": []
}
},
"rules": [
{
"type": "restrict_actions_actors",
"parameters": {
"allowed_actors": [
{
"id": 5,
"type": "User"
},
{
"id": 1234,
"type": "Team"
}
]
}
}
],
"node_id": "RUL_lA",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Delete an organization Actions policy
Delete an Actions policy for an organization.
Tokens de acesso granulares para "Delete an organization Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" organization permissions (write)
Parâmetros para "Delete an organization Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
policy_id integer ObrigatórioThe ID of the policy. |
Códigos de status de resposta HTTP para "Delete an organization Actions policy"
| Código de status | Descrição |
|---|---|
204 | No Content |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "Delete an organization Actions policy"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/actions/policies/POLICY_IDResponse
Status: 204List repository Actions policies
List all Actions policies for a repository.
Tokens de acesso granulares para "List repository Actions policies"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" repository permissions (write)
Parâmetros para "List repository Actions policies"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
| Nome, Tipo, Descrição |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
has_parents boolean Include policies configured at higher levels that apply to this repository Padrão: |
Códigos de status de resposta HTTP para "List repository Actions policies"
| Código de status | Descrição |
|---|---|
200 | OK |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "List repository Actions policies"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/actions/policiesResponse
Status: 200{
"total_count": 2,
"policies": [
{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"node_id": "RUL_lA",
"_links": {
"self": {
"href": "https://api.github.com/enterprises/enterprise/actions/policies/1"
},
"html": {
"href": "https://github.com/enterprises/enterprise/settings/policies/actions/1"
}
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"name": "Restrict workflow events",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "evaluate",
"node_id": "RUL_lB",
"_links": {
"self": {
"href": "https://api.github.com/enterprises/enterprise/actions/policies/2"
},
"html": {
"href": "https://github.com/enterprises/enterprise/settings/policies/actions/2"
}
},
"created_at": "2024-01-15T11:00:00Z",
"updated_at": "2024-01-15T11:00:00Z"
}
]
}Create a repository Actions policy
Create an Actions policy for a repository.
Omitting workflow_path targets all workflows without storing an explicit condition.
Tokens de acesso granulares para "Create a repository Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" repository permissions (write)
Parâmetros para "Create a repository Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
| Nome, Tipo, Descrição | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name string ObrigatórioThe name of the policy. | |||||||||||||||||||||
enforcement string ObrigatórioThe enforcement level of the ruleset. Pode ser um dos: | |||||||||||||||||||||
conditions object Conditions for a repository Actions policy. The object may be empty to preserve or use the
default workflow targeting, or contain only | |||||||||||||||||||||
Can be one of these objects:
| |||||||||||||||||||||
rules array of objects An array of rules within the policy. | |||||||||||||||||||||
Can be one of these objects:
restrict_action_events object Choose specific GitHub events that will trigger Actions workflows. Properties of |
| Nome, Tipo, Descrição | ||
|---|---|---|
type string ObrigatórioValor: | ||
parameters object | ||
Properties of |
| Nome, Tipo, Descrição |
|---|
allowed_events array of strings ObrigatórioSelect the events that can trigger Actions workflows.
Supported values are: |
Códigos de status de resposta HTTP para "Create a repository Actions policy"
| Código de status | Descrição |
|---|---|
201 | Created |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
Exemplos de código para "Create a repository Actions policy"
Exemplo de solicitação
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/actions/policies \
-d '{"name":"Require approved actors","enforcement":"active","rules":[{"type":"restrict_actions_actors","parameters":{"allowed_actors":[{"id":1234,"type":"Team"}]}}]}'Response
Status: 201{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"conditions": {
"organization_name": {
"include": [
"octo-org"
],
"exclude": []
},
"repository_name": {
"include": [
"octo-repo"
],
"exclude": []
}
},
"rules": [
{
"type": "restrict_actions_actors",
"parameters": {
"allowed_actors": [
{
"id": 5,
"type": "User"
},
{
"id": 1234,
"type": "Team"
}
]
}
}
],
"node_id": "RUL_lA",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Get a repository Actions policy
Get a specific Actions policy for a repository.
Tokens de acesso granulares para "Get a repository Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" repository permissions (write)
Parâmetros para "Get a repository Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
policy_id integer ObrigatórioThe ID of the policy. |
Códigos de status de resposta HTTP para "Get a repository Actions policy"
| Código de status | Descrição |
|---|---|
200 | OK |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "Get a repository Actions policy"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/actions/policies/POLICY_IDResponse
Status: 200{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"conditions": {
"organization_name": {
"include": [
"octo-org"
],
"exclude": []
},
"repository_name": {
"include": [
"octo-repo"
],
"exclude": []
}
},
"rules": [
{
"type": "restrict_actions_actors",
"parameters": {
"allowed_actors": [
{
"id": 5,
"type": "User"
},
{
"id": 1234,
"type": "Team"
}
]
}
}
],
"node_id": "RUL_lA",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Update a repository Actions policy
Update an Actions policy for a repository.
Omitting workflow_path preserves the policy's existing workflow targeting.
Tokens de acesso granulares para "Update a repository Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" repository permissions (write)
Parâmetros para "Update a repository Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
policy_id integer ObrigatórioThe ID of the policy. |
| Nome, Tipo, Descrição | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name string The name of the policy. | |||||||||||||||||||||
enforcement string The enforcement level of the ruleset. Pode ser um dos: | |||||||||||||||||||||
conditions object Conditions for a repository Actions policy. The object may be empty to preserve or use the
default workflow targeting, or contain only | |||||||||||||||||||||
Can be one of these objects:
| |||||||||||||||||||||
rules array of objects An array of rules within the policy. | |||||||||||||||||||||
Can be one of these objects:
restrict_action_events object Choose specific GitHub events that will trigger Actions workflows. Properties of |
| Nome, Tipo, Descrição | ||
|---|---|---|
type string ObrigatórioValor: | ||
parameters object | ||
Properties of |
| Nome, Tipo, Descrição |
|---|
allowed_events array of strings ObrigatórioSelect the events that can trigger Actions workflows.
Supported values are: |
Códigos de status de resposta HTTP para "Update a repository Actions policy"
| Código de status | Descrição |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
Exemplos de código para "Update a repository Actions policy"
Exemplo de solicitação
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/actions/policies/POLICY_ID \
-d '{"name":"Updated policy name","enforcement":"active"}'Response
Status: 200{
"id": 1,
"name": "Restrict workflow modifications",
"target": "actions",
"source_type": "Enterprise",
"source": "enterprise",
"enforcement": "active",
"conditions": {
"organization_name": {
"include": [
"octo-org"
],
"exclude": []
},
"repository_name": {
"include": [
"octo-repo"
],
"exclude": []
}
},
"rules": [
{
"type": "restrict_actions_actors",
"parameters": {
"allowed_actors": [
{
"id": 5,
"type": "User"
},
{
"id": 1234,
"type": "Team"
}
]
}
}
],
"node_id": "RUL_lA",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Delete a repository Actions policy
Delete an Actions policy for a repository.
Tokens de acesso granulares para "Delete a repository Actions policy"
Este endpoint funciona com os seguintes tipos de token granulares:
- tokens de acesso do usuário do aplicativo GitHub
- tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Administration" repository permissions (write)
Parâmetros para "Delete a repository Actions policy"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
policy_id integer ObrigatórioThe ID of the policy. |
Códigos de status de resposta HTTP para "Delete a repository Actions policy"
| Código de status | Descrição |
|---|---|
204 | No Content |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "Delete a repository Actions policy"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/actions/policies/POLICY_IDResponse
Status: 204