Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para permissões do GitHub Actions

Use a API REST para interagir com as permissões para o GitHub Actions.

Sobre as permissões para o GitHub Actions

Você pode usar a API REST para definir as permissões para as empresas , repositórios que tenham permissão para executar GitHub Actions, para as ações e para os fluxos de trabalho reutilizáveis que podem ser executados. Para saber mais, confira Cobrança e uso.

Get artifact and log retention settings for an organization

Gets artifact and log retention settings for an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Get artifact and log retention settings for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get artifact and log retention settings for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get artifact and log retention settings for an organization"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get artifact and log retention settings for an organization"

Exemplo de solicitação

get/organizations/{org}/actions/permissions/artifact-and-log-retention
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/artifact-and-log-retention

Example response

Status: 200
{ "days": 90, "maximum_allowed_days": 365 }

Set artifact and log retention settings for an organization

Sets artifact and log retention settings for an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Set artifact and log retention settings for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set artifact and log retention settings for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
days integer Obrigatório

The number of days to retain artifacts and logs

Códigos de status de resposta HTTP para "Set artifact and log retention settings for an organization"

Código de statusDescrição
204

No content

403

Forbidden

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set artifact and log retention settings for an organization"

Exemplo de solicitação

put/organizations/{org}/actions/permissions/artifact-and-log-retention
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/artifact-and-log-retention \ -d '{"days":100}'

No content

Status: 204

Get fork PR contributor approval permissions for an organization

Gets the fork PR contributor approval policy for an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Get fork PR contributor approval permissions for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get fork PR contributor approval permissions for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get fork PR contributor approval permissions for an organization"

Código de statusDescrição
200

OK

404

Resource not found

Exemplos de código para "Get fork PR contributor approval permissions for an organization"

Exemplo de solicitação

get/organizations/{org}/actions/permissions/fork-pr-contributor-approval
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/fork-pr-contributor-approval

Response

Status: 200
{ "approval_policy": "first_time_contributors" }

Set fork PR contributor approval permissions for an organization

Sets the fork PR contributor approval policy for an organization.

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

Tokens de acesso refinados para "Set fork PR contributor approval permissions for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set fork PR contributor approval permissions for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
approval_policy string Obrigatório

The policy that controls when fork PR workflows require approval from a maintainer.

Pode ser um dos: first_time_contributors_new_to_github, first_time_contributors, all_external_contributors

Códigos de status de resposta HTTP para "Set fork PR contributor approval permissions for an organization"

Código de statusDescrição
204

No Content

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set fork PR contributor approval permissions for an organization"

Exemplo de solicitação

put/organizations/{org}/actions/permissions/fork-pr-contributor-approval
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/fork-pr-contributor-approval \ -d '{"approval_policy":"first_time_contributors"}'

Response

Status: 204

Get private repo fork PR workflow settings for an organization

Gets the settings for whether workflows from fork pull requests can run on private repositories in an organization.

Tokens de acesso refinados para "Get private repo fork PR workflow settings for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get private repo fork PR workflow settings for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get private repo fork PR workflow settings for an organization"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get private repo fork PR workflow settings for an organization"

Exemplo de solicitação

get/organizations/{org}/actions/permissions/fork-pr-workflows-private-repos
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/fork-pr-workflows-private-repos

Response

Status: 200
{ "run_workflows_from_fork_pull_requests": true, "send_write_tokens_to_workflows": false, "send_secrets_and_variables": false, "require_approval_for_fork_pr_workflows": true }

Set private repo fork PR workflow settings for an organization

Sets the settings for whether workflows from fork pull requests can run on private repositories in an organization.

Tokens de acesso refinados para "Set private repo fork PR workflow settings for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set private repo fork PR workflow settings for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
run_workflows_from_fork_pull_requests boolean Obrigatório

Whether workflows triggered by pull requests from forks are allowed to run on private repositories.

send_write_tokens_to_workflows boolean

Whether GitHub Actions can create pull requests or submit approving pull request reviews from a workflow triggered by a fork pull request.

send_secrets_and_variables boolean

Whether to make secrets and variables available to workflows triggered by pull requests from forks.

require_approval_for_fork_pr_workflows boolean

Whether workflows triggered by pull requests from forks require approval from a repository administrator to run.

Códigos de status de resposta HTTP para "Set private repo fork PR workflow settings for an organization"

Código de statusDescrição
204

Empty response for successful settings update

403

Forbidden - Fork PR workflow settings for private repositories are managed by the enterprise owner

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set private repo fork PR workflow settings for an organization"

Exemplo de solicitação

put/organizations/{org}/actions/permissions/fork-pr-workflows-private-repos
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/fork-pr-workflows-private-repos \ -d '{"run_workflows_from_fork_pull_requests":true,"send_write_tokens_to_workflows":false,"send_secrets_and_variables":false,"require_approval_for_fork_pr_workflows":true}'

Empty response for successful settings update

Status: 204

Get self-hosted runners settings for an organization

Gets the settings for self-hosted runners for an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Get self-hosted runners settings for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get self-hosted runners settings for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get self-hosted runners settings for an organization"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get self-hosted runners settings for an organization"

Exemplo de solicitação

get/organizations/{org}/actions/permissions/self-hosted-runners
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/self-hosted-runners

Example response

Status: 200
{ "enabled_repositories": "selected", "selected_repositories_url": "http://api.github.localhost/organizations/1/actions/permissions/self-hosted-runners/repositories" }

Set self-hosted runners settings for an organization

Sets the settings for self-hosted runners for an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Set self-hosted runners settings for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set self-hosted runners settings for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
enabled_repositories string Obrigatório

The policy that controls whether self-hosted runners can be used in the organization

Pode ser um dos: all, selected, none

Códigos de status de resposta HTTP para "Set self-hosted runners settings for an organization"

Código de statusDescrição
204

No content

403

Forbidden

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set self-hosted runners settings for an organization"

Exemplo de solicitação

put/organizations/{org}/actions/permissions/self-hosted-runners
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/self-hosted-runners \ -d '{"enabled_repositories":"all"}'

No content

Status: 204

List repositories allowed to use self-hosted runners in an organization

Lists repositories that are allowed to use self-hosted runners in an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "List repositories allowed to use self-hosted runners in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "List repositories allowed to use self-hosted runners in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros de consulta
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: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "List repositories allowed to use self-hosted runners in an organization"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "List repositories allowed to use self-hosted runners in an organization"

Exemplo de solicitação

get/organizations/{org}/actions/permissions/self-hosted-runners/repositories
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/self-hosted-runners/repositories

Response

Status: 200
{ "total_count": 1, "repositories": [ { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "git@github.com:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "clone_url": "https://github.com/octocat/Hello-World.git", "mirror_url": "git:git.example.com/octocat/Hello-World", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", "svn_url": "https://svn.github.com/octocat/Hello-World", "homepage": "https://github.com", "language": null, "forks_count": 9, "stargazers_count": 80, "watchers_count": 80, "size": 108, "default_branch": "master", "open_issues_count": 0, "is_template": true, "topics": [ "octocat", "atom", "electron", "api" ], "has_issues": true, "has_projects": true, "has_wiki": true, "has_pages": false, "has_downloads": true, "archived": false, "disabled": false, "visibility": "public", "pushed_at": "2011-01-26T19:06:43Z", "created_at": "2011-01-26T19:01:12Z", "updated_at": "2011-01-26T19:14:43Z", "permissions": { "admin": false, "push": false, "pull": true }, "allow_rebase_merge": true, "template_repository": null, "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", "allow_squash_merge": true, "allow_auto_merge": false, "delete_branch_on_merge": true, "allow_merge_commit": true, "subscribers_count": 42, "network_count": 0, "license": { "key": "mit", "name": "MIT License", "url": "https://api.github.com/licenses/mit", "spdx_id": "MIT", "node_id": "MDc6TGljZW5zZW1pdA==", "html_url": "https://github.com/licenses/mit" }, "forks": 1, "open_issues": 1, "watchers": 1 } ] }

Set repositories allowed to use self-hosted runners in an organization

Sets repositories that are allowed to use self-hosted runners in an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Set repositories allowed to use self-hosted runners in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set repositories allowed to use self-hosted runners in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
selected_repository_ids array of integers Obrigatório

IDs of repositories that can use repository-level self-hosted runners

Códigos de status de resposta HTTP para "Set repositories allowed to use self-hosted runners in an organization"

Código de statusDescrição
204

No content

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set repositories allowed to use self-hosted runners in an organization"

Exemplo de solicitação

put/organizations/{org}/actions/permissions/self-hosted-runners/repositories
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/self-hosted-runners/repositories \ -d '{"selected_repository_ids":[1,2,3]}'

No content

Status: 204

Add a repository to the list of repositories allowed to use self-hosted runners in an organization

Adds a repository to the list of repositories that are allowed to use self-hosted runners in an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Add a repository to the list of repositories allowed to use self-hosted runners in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write) and "Metadata" repository permissions (read)

Parâmetros para "Add a repository to the list of repositories allowed to use self-hosted runners in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

repository_id integer Obrigatório

The unique identifier of the repository.

Códigos de status de resposta HTTP para "Add a repository to the list of repositories allowed to use self-hosted runners in an organization"

Código de statusDescrição
204

No content

403

Forbidden

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Add a repository to the list of repositories allowed to use self-hosted runners in an organization"

Exemplo de solicitação

put/organizations/{org}/actions/permissions/self-hosted-runners/repositories/{repository_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/self-hosted-runners/repositories/REPOSITORY_ID

No content

Status: 204

Remove a repository from the list of repositories allowed to use self-hosted runners in an organization

Removes a repository from the list of repositories that are allowed to use self-hosted runners in an organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope or the "Actions policies" fine-grained permission to use this endpoint.

Tokens de acesso refinados para "Remove a repository from the list of repositories allowed to use self-hosted runners in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write) and "Metadata" repository permissions (read)

Parâmetros para "Remove a repository from the list of repositories allowed to use self-hosted runners in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

repository_id integer Obrigatório

The unique identifier of the repository.

Códigos de status de resposta HTTP para "Remove a repository from the list of repositories allowed to use self-hosted runners in an organization"

Código de statusDescrição
204

No content

403

Forbidden

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Remove a repository from the list of repositories allowed to use self-hosted runners in an organization"

Exemplo de solicitação

delete/organizations/{org}/actions/permissions/self-hosted-runners/repositories/{repository_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/organizations/ORG/actions/permissions/self-hosted-runners/repositories/REPOSITORY_ID

No content

Status: 204

Get GitHub Actions permissions for an organization

Gets 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.

Tokens de acesso refinados para "Get GitHub Actions permissions for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get GitHub Actions permissions for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get GitHub Actions permissions for an organization"

Código de statusDescrição
200

OK

Exemplos de código para "Get GitHub Actions permissions for an organization"

Exemplo de solicitação

get/orgs/{org}/actions/permissions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions

Response

Status: 200
{ "enabled_repositories": "all", "allowed_actions": "selected", "selected_actions_url": "https://api.github.com/organizations/42/actions/permissions/selected-actions" }

Set GitHub Actions permissions for an organization

Sets 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.

Tokens de acesso refinados para "Set GitHub Actions permissions for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set GitHub Actions permissions for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
enabled_repositories string Obrigatório

The policy that controls the repositories in the organization that are allowed to run GitHub Actions.

Pode ser um dos: all, none, selected

allowed_actions string

The permissions policy that controls the actions and reusable workflows that are allowed to run.

Pode ser um dos: all, local_only, selected

Códigos de status de resposta HTTP para "Set GitHub Actions permissions for an organization"

Código de statusDescrição
204

No Content

Exemplos de código para "Set GitHub Actions permissions for an organization"

Exemplo de solicitação

put/orgs/{org}/actions/permissions
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions \ -d '{"enabled_repositories":"all","allowed_actions":"selected"}'

Response

Status: 204

List selected repositories enabled for GitHub Actions in an organization

Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for enabled_repositories must be configured to selected. For more information, see "Set GitHub Actions permissions for an organization."

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

Tokens de acesso refinados para "List selected repositories enabled for GitHub Actions in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "List selected repositories enabled for GitHub Actions in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros de consulta
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: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "List selected repositories enabled for GitHub Actions in an organization"

Código de statusDescrição
200

OK

Exemplos de código para "List selected repositories enabled for GitHub Actions in an organization"

Exemplo de solicitação

get/orgs/{org}/actions/permissions/repositories
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/repositories

Response

Status: 200
{ "total_count": 1, "repositories": [ { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "git@github.com:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "clone_url": "https://github.com/octocat/Hello-World.git", "mirror_url": "git:git.example.com/octocat/Hello-World", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", "svn_url": "https://svn.github.com/octocat/Hello-World", "homepage": "https://github.com", "language": null, "forks_count": 9, "stargazers_count": 80, "watchers_count": 80, "size": 108, "default_branch": "master", "open_issues_count": 0, "is_template": true, "topics": [ "octocat", "atom", "electron", "api" ], "has_issues": true, "has_projects": true, "has_wiki": true, "has_pages": false, "has_downloads": true, "archived": false, "disabled": false, "visibility": "public", "pushed_at": "2011-01-26T19:06:43Z", "created_at": "2011-01-26T19:01:12Z", "updated_at": "2011-01-26T19:14:43Z", "permissions": { "admin": false, "push": false, "pull": true }, "allow_rebase_merge": true, "template_repository": null, "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", "allow_squash_merge": true, "allow_auto_merge": false, "delete_branch_on_merge": true, "allow_merge_commit": true, "subscribers_count": 42, "network_count": 0, "license": { "key": "mit", "name": "MIT License", "url": "https://api.github.com/licenses/mit", "spdx_id": "MIT", "node_id": "MDc6TGljZW5zZW1pdA==", "html_url": "https://github.com/licenses/mit" }, "forks": 1, "open_issues": 1, "watchers": 1 } ] }

Set selected repositories enabled for GitHub Actions in an organization

Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for enabled_repositories must be configured to selected. For more information, see "Set GitHub Actions permissions for an organization."

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

Tokens de acesso refinados para "Set selected repositories enabled for GitHub Actions in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set selected repositories enabled for GitHub Actions in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
selected_repository_ids array of integers Obrigatório

List of repository IDs to enable for GitHub Actions.

Códigos de status de resposta HTTP para "Set selected repositories enabled for GitHub Actions in an organization"

Código de statusDescrição
204

No Content

Exemplos de código para "Set selected repositories enabled for GitHub Actions in an organization"

Exemplo de solicitação

put/orgs/{org}/actions/permissions/repositories
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/repositories \ -d '{"selected_repository_ids":[32,42]}'

Response

Status: 204

Enable a selected repository for GitHub Actions in an organization

Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for enabled_repositories must be must be configured to selected. For more information, see "Set GitHub Actions permissions for an organization."

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

Tokens de acesso refinados para "Enable a selected repository for GitHub Actions in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write) and "Metadata" repository permissions (read)

Parâmetros para "Enable a selected repository for GitHub Actions in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

repository_id integer Obrigatório

The unique identifier of the repository.

Códigos de status de resposta HTTP para "Enable a selected repository for GitHub Actions in an organization"

Código de statusDescrição
204

No Content

Exemplos de código para "Enable a selected repository for GitHub Actions in an organization"

Exemplo de solicitação

put/orgs/{org}/actions/permissions/repositories/{repository_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/repositories/REPOSITORY_ID

Response

Status: 204

Disable a selected repository for GitHub Actions in an organization

Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for enabled_repositories must be configured to selected. For more information, see "Set GitHub Actions permissions for an organization."

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

Tokens de acesso refinados para "Disable a selected repository for GitHub Actions in an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write) and "Metadata" repository permissions (read)

Parâmetros para "Disable a selected repository for GitHub Actions in an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

repository_id integer Obrigatório

The unique identifier of the repository.

Códigos de status de resposta HTTP para "Disable a selected repository for GitHub Actions in an organization"

Código de statusDescrição
204

No Content

Exemplos de código para "Disable a selected repository for GitHub Actions in an organization"

Exemplo de solicitação

delete/orgs/{org}/actions/permissions/repositories/{repository_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/repositories/REPOSITORY_ID

Response

Status: 204

Get allowed actions and reusable workflows for an organization

Gets the selected actions and reusable workflows that are allowed in an organization. To use this endpoint, the organization permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for an organization."

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

Tokens de acesso refinados para "Get allowed actions and reusable workflows for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get allowed actions and reusable workflows for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get allowed actions and reusable workflows for an organization"

Código de statusDescrição
200

OK

Exemplos de código para "Get allowed actions and reusable workflows for an organization"

Exemplo de solicitação

get/orgs/{org}/actions/permissions/selected-actions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/selected-actions

Response

Status: 200
{ "github_owned_allowed": true, "verified_allowed": false, "patterns_allowed": [ "monalisa/octocat@*", "docker/*" ] }

Set allowed actions and reusable workflows for an organization

Sets the actions and reusable workflows that are allowed in an organization. To use this endpoint, the organization permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for an organization."

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

Tokens de acesso refinados para "Set allowed actions and reusable workflows for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set allowed actions and reusable workflows for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
github_owned_allowed boolean

Whether GitHub-owned actions are allowed. For example, this includes the actions in the actions organization.

verified_allowed boolean

Whether actions from GitHub Marketplace verified creators are allowed. Set to true to allow all actions by GitHub Marketplace verified creators.

patterns_allowed array of strings

Specifies a list of string-matching patterns to allow specific action(s) and reusable workflow(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*.

Note

The patterns_allowed setting only applies to public repositories.

Códigos de status de resposta HTTP para "Set allowed actions and reusable workflows for an organization"

Código de statusDescrição
204

No Content

Exemplos de código para "Set allowed actions and reusable workflows for an organization"

Exemplo de solicitação

put/orgs/{org}/actions/permissions/selected-actions
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/selected-actions \ -d '{"github_owned_allowed":true,"verified_allowed":false,"patterns_allowed":["monalisa/octocat@*","docker/*"]}'

Response

Status: 204

Get default workflow permissions for an organization

Gets the default workflow permissions granted to the GITHUB_TOKEN when running workflows in an organization, as well as whether GitHub Actions can submit approving pull request reviews. For more information, see "Setting the permissions of the GITHUB_TOKEN for your organization."

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

Tokens de acesso refinados para "Get default workflow permissions for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (read)

Parâmetros para "Get default workflow permissions for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get default workflow permissions for an organization"

Código de statusDescrição
200

OK

Exemplos de código para "Get default workflow permissions for an organization"

Exemplo de solicitação

get/orgs/{org}/actions/permissions/workflow
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/workflow

Give read-only permission, and allow approving PRs.

Status: 200
{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }

Set default workflow permissions for an organization

Sets the default workflow permissions granted to the GITHUB_TOKEN when running workflows in an organization, and sets if GitHub Actions can submit approving pull request reviews. For more information, see "Setting the permissions of the GITHUB_TOKEN for your organization."

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

Tokens de acesso refinados para "Set default workflow permissions for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" organization permissions (write)

Parâmetros para "Set default workflow permissions for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
default_workflow_permissions string

The default workflow permissions granted to the GITHUB_TOKEN when running workflows.

Pode ser um dos: read, write

can_approve_pull_request_reviews boolean

Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.

Códigos de status de resposta HTTP para "Set default workflow permissions for an organization"

Código de statusDescrição
204

Success response

Exemplos de código para "Set default workflow permissions for an organization"

Exemplo de solicitação

put/orgs/{org}/actions/permissions/workflow
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/actions/permissions/workflow \ -d '{"default_workflow_permissions":"read","can_approve_pull_request_reviews":true}'

Success response

Status: 204

Get GitHub Actions permissions for a repository

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.

Tokens de acesso refinados para "Get GitHub Actions permissions for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get GitHub Actions permissions for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get GitHub Actions permissions for a repository"

Código de statusDescrição
200

OK

Exemplos de código para "Get GitHub Actions permissions for a repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions

Response

Status: 200
{ "enabled": true, "allowed_actions": "selected", "selected_actions_url": "https://api.github.com/repositories/42/actions/permissions/selected-actions" }

Set GitHub Actions permissions for a repository

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.

Tokens de acesso refinados para "Set GitHub Actions permissions for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set GitHub Actions permissions for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
enabled boolean Obrigatório

Whether GitHub Actions is enabled on the repository.

allowed_actions string

The permissions policy that controls the actions and reusable workflows that are allowed to run.

Pode ser um dos: all, local_only, selected

Códigos de status de resposta HTTP para "Set GitHub Actions permissions for a repository"

Código de statusDescrição
204

No Content

Exemplos de código para "Set GitHub Actions permissions for a repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions \ -d '{"enabled":true,"allowed_actions":"selected"}'

Response

Status: 204

Get the level of access for workflows outside of the repository

Gets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository. This endpoint only applies to private repositories. For more information, see "Allowing access to components in a private repository."

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

Tokens de acesso refinados para "Get the level of access for workflows outside of the repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get the level of access for workflows outside of the repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get the level of access for workflows outside of the repository"

Código de statusDescrição
200

OK

Exemplos de código para "Get the level of access for workflows outside of the repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions/access
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/access

Response

Status: 200
{ "access_level": "organization" }

Set the level of access for workflows outside of the repository

Sets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository. This endpoint only applies to private repositories. For more information, see "Allowing access to components in a private repository".

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

Tokens de acesso refinados para "Set the level of access for workflows outside of the repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set the level of access for workflows outside of the repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
access_level string Obrigatório

Defines the level of access that workflows outside of the repository have to actions and reusable workflows within the repository.

none means the access is only possible from workflows in this repository. user level access allows sharing across user owned private repositories only. organization level access allows sharing across the organization.

Pode ser um dos: none, user, organization

Códigos de status de resposta HTTP para "Set the level of access for workflows outside of the repository"

Código de statusDescrição
204

No Content

Exemplos de código para "Set the level of access for workflows outside of the repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions/access
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/access \ -d '{"access_level":"organization"}'

Response

Status: 204

Get artifact and log retention settings for a repository

Gets artifact and log retention settings for a repository.

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

Tokens de acesso refinados para "Get artifact and log retention settings for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get artifact and log retention settings for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get artifact and log retention settings for a repository"

Código de statusDescrição
200

OK

404

Resource not found

Exemplos de código para "Get artifact and log retention settings for a repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/artifact-and-log-retention

Response

Status: 200
{ "days": 90, "maximum_allowed_days": 365 }

Set artifact and log retention settings for a repository

Sets artifact and log retention settings for a repository.

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

Tokens de acesso refinados para "Set artifact and log retention settings for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set artifact and log retention settings for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
days integer Obrigatório

The number of days to retain artifacts and logs

Códigos de status de resposta HTTP para "Set artifact and log retention settings for a repository"

Código de statusDescrição
204

Empty response for successful settings update

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set artifact and log retention settings for a repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/artifact-and-log-retention \ -d '{"days":90}'

Empty response for successful settings update

Status: 204

Get fork PR contributor approval permissions for a repository

Gets the fork PR contributor approval policy for a repository.

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

Tokens de acesso refinados para "Get fork PR contributor approval permissions for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get fork PR contributor approval permissions for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get fork PR contributor approval permissions for a repository"

Código de statusDescrição
200

OK

404

Resource not found

Exemplos de código para "Get fork PR contributor approval permissions for a repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/fork-pr-contributor-approval

Response

Status: 200
{ "approval_policy": "first_time_contributors" }

Set fork PR contributor approval permissions for a repository

Sets the fork PR contributor approval policy for a repository.

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

Tokens de acesso refinados para "Set fork PR contributor approval permissions for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set fork PR contributor approval permissions for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
approval_policy string Obrigatório

The policy that controls when fork PR workflows require approval from a maintainer.

Pode ser um dos: first_time_contributors_new_to_github, first_time_contributors, all_external_contributors

Códigos de status de resposta HTTP para "Set fork PR contributor approval permissions for a repository"

Código de statusDescrição
204

No Content

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set fork PR contributor approval permissions for a repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/fork-pr-contributor-approval \ -d '{"approval_policy":"first_time_contributors"}'

Response

Status: 204

Get private repo fork PR workflow settings for a repository

Gets the settings for whether workflows from fork pull requests can run on a private repository.

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

Tokens de acesso refinados para "Get private repo fork PR workflow settings for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get private repo fork PR workflow settings for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get private repo fork PR workflow settings for a repository"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get private repo fork PR workflow settings for a repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/fork-pr-workflows-private-repos

Response

Status: 200
{ "run_workflows_from_fork_pull_requests": true, "send_write_tokens_to_workflows": false, "send_secrets_and_variables": false, "require_approval_for_fork_pr_workflows": true }

Set private repo fork PR workflow settings for a repository

Sets the settings for whether workflows from fork pull requests can run on a private repository.

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

Tokens de acesso refinados para "Set private repo fork PR workflow settings for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set private repo fork PR workflow settings for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
run_workflows_from_fork_pull_requests boolean Obrigatório

Whether workflows triggered by pull requests from forks are allowed to run on private repositories.

send_write_tokens_to_workflows boolean

Whether GitHub Actions can create pull requests or submit approving pull request reviews from a workflow triggered by a fork pull request.

send_secrets_and_variables boolean

Whether to make secrets and variables available to workflows triggered by pull requests from forks.

require_approval_for_fork_pr_workflows boolean

Whether workflows triggered by pull requests from forks require approval from a repository administrator to run.

Códigos de status de resposta HTTP para "Set private repo fork PR workflow settings for a repository"

Código de statusDescrição
204

Empty response for successful settings update

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set private repo fork PR workflow settings for a repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/fork-pr-workflows-private-repos \ -d '{"run_workflows_from_fork_pull_requests":true,"send_write_tokens_to_workflows":false,"send_secrets_and_variables":false,"require_approval_for_fork_pr_workflows":true}'

Empty response for successful settings update

Status: 204

Get allowed actions and reusable workflows for a repository

Gets the settings for selected actions and reusable workflows that are allowed in a repository. To use this endpoint, the repository policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for a repository."

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

Tokens de acesso refinados para "Get allowed actions and reusable workflows for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get allowed actions and reusable workflows for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get allowed actions and reusable workflows for a repository"

Código de statusDescrição
200

OK

Exemplos de código para "Get allowed actions and reusable workflows for a repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions/selected-actions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/selected-actions

Response

Status: 200
{ "github_owned_allowed": true, "verified_allowed": false, "patterns_allowed": [ "monalisa/octocat@*", "docker/*" ] }

Set allowed actions and reusable workflows for a repository

Sets the actions and reusable workflows that are allowed in a repository. To use this endpoint, the repository permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for a repository."

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

Tokens de acesso refinados para "Set allowed actions and reusable workflows for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set allowed actions and reusable workflows for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
github_owned_allowed boolean

Whether GitHub-owned actions are allowed. For example, this includes the actions in the actions organization.

verified_allowed boolean

Whether actions from GitHub Marketplace verified creators are allowed. Set to true to allow all actions by GitHub Marketplace verified creators.

patterns_allowed array of strings

Specifies a list of string-matching patterns to allow specific action(s) and reusable workflow(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*.

Note

The patterns_allowed setting only applies to public repositories.

Códigos de status de resposta HTTP para "Set allowed actions and reusable workflows for a repository"

Código de statusDescrição
204

No Content

Exemplos de código para "Set allowed actions and reusable workflows for a repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions/selected-actions
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/selected-actions \ -d '{"github_owned_allowed":true,"verified_allowed":false,"patterns_allowed":["monalisa/octocat@*","docker/*"]}'

Response

Status: 204

Get default workflow permissions for a repository

Gets the default workflow permissions granted to the GITHUB_TOKEN when running workflows in a repository, as well as if GitHub Actions can submit approving pull request reviews. For more information, see "Setting the permissions of the GITHUB_TOKEN for your repository."

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

Tokens de acesso refinados para "Get default workflow permissions for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (read)

Parâmetros para "Get default workflow permissions for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get default workflow permissions for a repository"

Código de statusDescrição
200

OK

Exemplos de código para "Get default workflow permissions for a repository"

Exemplo de solicitação

get/repos/{owner}/{repo}/actions/permissions/workflow
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/workflow

Give read-only permission, and allow approving PRs.

Status: 200
{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }

Set default workflow permissions for a repository

Sets the default workflow permissions granted to the GITHUB_TOKEN when running workflows in a repository, and sets if GitHub Actions can submit approving pull request reviews. For more information, see "Setting the permissions of the GITHUB_TOKEN for your repository."

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

Tokens de acesso refinados para "Set default workflow permissions for a repository"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Administration" repository permissions (write)

Parâmetros para "Set default workflow permissions for a repository"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
owner string Obrigatório

The account owner of the repository. The name is not case sensitive.

repo string Obrigatório

The name of the repository without the .git extension. The name is not case sensitive.

Parâmetros do corpo
Nome, Tipo, Descrição
default_workflow_permissions string

The default workflow permissions granted to the GITHUB_TOKEN when running workflows.

Pode ser um dos: read, write

can_approve_pull_request_reviews boolean

Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.

Códigos de status de resposta HTTP para "Set default workflow permissions for a repository"

Código de statusDescrição
204

Success response

409

Conflict response when changing a setting is prevented by the owning organization

Exemplos de código para "Set default workflow permissions for a repository"

Exemplo de solicitação

put/repos/{owner}/{repo}/actions/permissions/workflow
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/actions/permissions/workflow \ -d '{"default_workflow_permissions":"read","can_approve_pull_request_reviews":true}'

Success response

Status: 204