Skip to content

GitHub: Get a repository Actions policy

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

← Actions operations · Get started

Operation github.actions_get_repo_actions_policy

Provider route: GET /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"]["actionsGetRepoActionsPolicy"]>[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.actionsGetRepoActionsPolicy(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_get_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

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

Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions
FieldTypePresenceDescription and constraints
$objectRootConditions for an enterprise Actions policy. The conditions object supports one organization
target (`organization_name`, `organization_id`, or `organization_property`) combined with one
repository target (`repository_name` or `repository_property`), and may also contain `workflow_path`.
$ (anyOf 1)objectAlternativeConditions to target organizations by name and repositories by name
$ (anyOf 1) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization name, repository name, workflow path Repository ruleset conditions for organization names
$ (anyOf 1) (allOf 2)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 3)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 2)objectAlternativeConditions to target organizations by name and repositories by property
$ (anyOf 2) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization name, repository name, workflow path Repository ruleset conditions for organization names
$ (anyOf 2) (allOf 2)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 2) (allOf 3)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 3)objectAlternativeConditions to target organizations by id and repositories by name
$ (anyOf 3) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization id, repository name, workflow path Repository ruleset conditions for organization I Ds
$ (anyOf 3) (allOf 2)ModelAll variants applyExpand Create an organization Actions policy — request body — body conditions repository name, workflow path Repository ruleset conditions for repository names
$ (anyOf 3) (allOf 3)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 4)objectAlternativeConditions to target organizations by id and repositories by property
$ (anyOf 4) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization id, repository name, workflow path Repository ruleset conditions for organization I Ds
$ (anyOf 4) (allOf 2)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 4) (allOf 3)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 5)objectAlternativeConditions to target organizations by property and repositories by name
$ (anyOf 5) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization property, repository name, workflow path Repository ruleset conditions for organization properties
$ (anyOf 5) (allOf 2)ModelAll variants applyExpand Create an organization Actions policy — request body — body conditions repository name, workflow path Repository ruleset conditions for repository names
$ (anyOf 5) (allOf 3)ModelAll variants applyExpand Create a repository Actions policy — request body — body conditions workflow path Actions policy workflow path condition
$ (anyOf 6)objectAlternativeConditions to target organizations by property and repositories by property
$ (anyOf 6) (allOf 1)ModelAll variants applyExpand Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization property, repository name, workflow path Repository ruleset conditions for organization properties
$ (anyOf 6) (allOf 2)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 6) (allOf 3)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 Enterprise Actions policy conditions organization id, repository name, workflow path Repository ruleset conditions for organization I Ds, Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization name, repository name, workflow path Repository ruleset conditions for organization names, Get a repository Actions policy — response body — conditions value Enterprise Actions policy conditions organization property, repository name, workflow path Repository ruleset conditions for organization properties, 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

SDK function policy ID: github.actions_get_repo_actions_policy. Catalog operation: actions/get-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.