Skip to main content

permissions

Creates, updates, deletes, gets or lists a permissions resource.

Overview

Namepermissions
TypeResource
Idgithub.actions.permissions

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
allowed_actionsstringThe permissions policy that controls the actions and reusable workflows that are allowed to run. (all, local_only, selected)
enabledbooleanWhether GitHub Actions is enabled on the repository.
selected_actions_urlstringThe API URL to use to get or set the actions and reusable workflows that are allowed to run, when allowed_actions is set to selected.
sha_pinning_requiredbooleanWhether actions must be pinned to a full-length commit SHA.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_github_actions_permissions_repositoryselectowner, repoGets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions and reusable workflows allowed to run in the repository.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
get_github_actions_permissions_organizationselectorgGets the GitHub Actions permissions policy for repositories and allowed actions and reusable workflows in an organization.

OAuth tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
set_github_actions_permissions_repositoryreplaceowner, repo, enabledSets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions and reusable workflows in the repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
set_github_actions_permissions_organizationreplaceorg, enabled_repositoriesSets the GitHub Actions permissions policy for repositories and allowed actions and reusable workflows in an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
orgstringThe organization name. The name is not case sensitive.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.

SELECT examples

Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions and reusable workflows allowed to run in the repository.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

SELECT
allowed_actions,
enabled,
selected_actions_url,
sha_pinning_required
FROM github.actions.permissions
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
;

REPLACE examples

Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions and reusable workflows in the repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

REPLACE github.actions.permissions
SET
enabled = {{ enabled }},
allowed_actions = '{{ allowed_actions }}',
sha_pinning_required = {{ sha_pinning_required }}
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND enabled = {{ enabled }} --required;