Skip to content

GitHub: Update a repository Actions policy

GitHub actions.actionsUpdateRepoActionsPolicy: arguments, response, policy and SDK examples.

← Actions operations · Get started

Operation github.actions_update_repo_actions_policy

Provider route: PUT /repos/{owner}/{repo}/actions/policies/{policy_id}. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["actions"]["actionsUpdateRepoActionsPolicy"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.actions.actionsUpdateRepoActionsPolicy(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_github import GitHubIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.actions.actions_update_repo_actions_policy(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.ownerstringRequired within parent
path.repostringRequired within parent
path.policy_idintegerRequired within parent
bodyobjectRequired within parent
body.conditionsModelOptionalExpand Create a repository Actions policy — request body — body conditions
body.enforcementstringOptionalThe enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).
One of: disabled, active, evaluate
body.namestringOptionalThe name of the policy.
body.rulesarrayOptionalAn array of rules within the policy.
body.rules[]ModelEach itemExpand Create a repository Actions policy — request body — body rules item

Referenced models: Create a repository Actions policy — request body — body conditions, Create a repository Actions policy — request body — body rules item

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Get a repository Actions policy — response body

Referenced models: Get a repository Actions policy — response body

15 more schemas are linked from the tables above, on the schema pages.

Get a repository Actions policy — response body
FieldTypePresenceDescription and constraints
$objectRootAn Actions policy defines rules for workflow execution protection.
_linksobjectOptional
_links.htmlobjectOptional
_links.html.hrefstringOptionalThe html URL of the policy
_links.selfobjectOptional
_links.self.hrefstringOptionalThe URL of the policy
conditionsJSONOptional
conditions (anyOf 1)JSONAlternativeWhen workflow path targeting is available, detailed responses represent an omitted stored
workflow condition as `workflow_path` with `include` set to `["~ALL"]` and `exclude` set to `[]`.
When workflow path targeting is unavailable, an omitted stored condition remains omitted.
conditions (anyOf 1) (anyOf 1)ModelAlternativeExpand Get a repository Actions policy — response body — conditions value Repository Actions policy conditions
conditions (anyOf 1) (anyOf 2)ModelAlternativeExpand Get a repository Actions policy — response body — conditions value Organization Actions policy conditions
conditions (anyOf 1) (anyOf 3)ModelAlternativeExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions
conditions (anyOf 2)nullAlternative
created_atstringOptionalFormat: date-time
enforcementstringRequired within parentThe enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).
Known values: disabled, active, evaluate
idJSONRequired within parent
id (anyOf 1)integerAlternativeThe ID of the policy
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
namestringRequired within parentThe name of the policy
node_idstringOptional
rulesarrayOptionalAn array of rules within the policy
rules[]ModelEach itemExpand Get a repository Actions policy — response body — rules item
sourcestringRequired within parentThe name of the source
source_typestringRequired within parentThe type of the source of the policy
Known values: Repository, Organization, Enterprise
targetstringRequired within parentThe target of the policy
Known values: actions
updated_atstringOptionalFormat: date-time

Referenced models: Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions, Get a repository Actions policy — response body — conditions value Organization Actions policy conditions, Get a repository Actions policy — response body — conditions value Repository Actions policy conditions, Get a repository Actions policy — response body — rules item

Create a repository Actions policy — request body — body conditions
FieldTypePresenceDescription and constraints
$objectRootConditions for a repository Actions policy. The object may be empty to preserve or use the
default workflow targeting, or contain only `workflow_path`.
$ (oneOf 1)objectAlternativeMaximum fields: 0
$ (oneOf 2)JSONAlternativeMaximum fields: 1
$ (oneOf 2) (allOf 1)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition

Referenced models: Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition

Create a repository Actions policy — request body — body rules item
FieldTypePresenceDescription and constraints
$objectRootAn actions rule.
$ (oneOf 1)ModelAlternativeExpand Create a repository Actions policy — request body — body rules item restrict actions actors
$ (oneOf 2)ModelAlternativeExpand Create a repository Actions policy — request body — body rules item restrict action events

Referenced models: Create a repository Actions policy — request body — body rules item restrict action events, Create a repository Actions policy — request body — body rules item restrict actions actors

Get a repository Actions policy — response body — conditions value Organization Actions policy conditions
FieldTypePresenceDescription and constraints
$objectRootConditions for an organization Actions policy. The conditions object should contain one of
`repository_name`, `repository_id`, or `repository_property`, and may also contain `workflow_path`.
$ (anyOf 1)JSONAlternative
$ (anyOf 1) (allOf 1)ModelAll variants applyExpand Create an organization Actions policy — request body — body conditions repository name, workflow path Repository ruleset conditions for repository names
$ (anyOf 1) (allOf 2)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 2)JSONAlternative
$ (anyOf 2) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Organization Actions policy conditions repository id, workflow path Repository ruleset conditions for repository I Ds
$ (anyOf 2) (allOf 2)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 3)JSONAlternative
$ (anyOf 3) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Organization Actions policy conditions repository property, workflow path Repository ruleset conditions for repository properties
$ (anyOf 3) (allOf 2)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition

Referenced models: Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition, Get a repository Actions policy — response body — conditions value Organization Actions policy conditions repository id, workflow path Repository ruleset conditions for repository I Ds, Create an organization Actions policy — request body — body conditions repository name, workflow path Repository ruleset conditions for repository names, Get a repository Actions policy — response body — conditions value Organization Actions policy conditions repository property, workflow path Repository ruleset conditions for repository properties

Get a repository Actions policy — response body — conditions value Repository Actions policy conditions
FieldTypePresenceDescription and constraints
$objectRootConditions for a repository Actions policy. The object may be empty to preserve or use the
default workflow targeting, or contain only `workflow_path`.
$ (anyOf 1)objectAlternativeMaximum fields: 0
$ (anyOf 2)JSONAlternativeMaximum fields: 1
$ (anyOf 2) (allOf 1)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition

Referenced models: Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition

Get a repository Actions policy — response body — rules item
FieldTypePresenceDescription and constraints
$objectRootAn actions rule.
$ (anyOf 1)ModelAlternativeExpand Get a repository Actions policy — response body — rules item restrict actions actors
$ (anyOf 2)ModelAlternativeExpand Get a repository Actions policy — response body — rules item restrict action events

Referenced models: Get a repository Actions policy — response body — rules item restrict action events, Get a repository Actions policy — response body — rules item restrict actions actors

Create a repository Actions policy — request body — body rules item restrict actions actors parameters allowed actors item
FieldTypePresenceDescription and constraints
$objectRootAn actor authorized to trigger Actions workflows
idintegerRequired within parentID of the actor authorized to trigger Actions workflows.
typestringRequired within parentThe type of the actor
One of: User, Bot, Team, BusinessTeam, EnterpriseTeam, IntegrationInstallation, App, RepositoryRole

SDK function policy ID: github.actions_update_repo_actions_policy. Catalog operation: actions/update-repo-actions-policy. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.