# Generated by `mix github.gen` from docs/github-api/api.github.com.json. # Do not edit by hand; re-run the task instead. defmodule Noizu.Github.Api.Actions do @moduledoc """ GitHub `actions` API. """ import Noizu.Github @doc """ Add custom labels to a self-hosted runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-organization """ def add_custom_labels_to_self_hosted_runner_for_org(org, runner_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}/labels" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Add custom labels to a self-hosted runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-a-repository """ def add_custom_labels_to_self_hosted_runner_for_repo(runner_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}/labels" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Add repository access to a self-hosted runner group in an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization """ def add_repo_access_to_self_hosted_runner_group_in_org( org, runner_group_id, repository_id, body, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/repositories/#{repository_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Add selected repository to an organization secret @see https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret """ def add_selected_repo_to_org_secret(org, secret_name, repository_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}/repositories/#{repository_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Add selected repository to an organization variable @see https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable """ def add_selected_repo_to_org_variable(org, name, repository_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables/#{name}/repositories/#{repository_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Add a self-hosted runner to a group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization """ def add_self_hosted_runner_to_group_for_org( org, runner_group_id, runner_id, body, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/runners/#{runner_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Approve a workflow run for a fork pull request @see https://docs.github.com/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request """ def approve_workflow_run(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/approve" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Cancel a workflow run @see https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run """ def cancel_workflow_run(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/cancel" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Create an environment variable @see https://docs.github.com/rest/actions/variables#create-an-environment-variable """ def create_environment_variable(environment_name, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/variables" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Create a GitHub-hosted runner for an organization @see https://docs.github.com/rest/actions/hosted-runners#create-a-github-hosted-runner-for-an-organization """ def create_hosted_runner_for_org(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners" body = body api_call(:post, url, body, Noizu.Github.ActionsHostedRunner, options) end @doc """ Create or update an environment secret @see https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret """ def create_or_update_environment_secret(environment_name, secret_name, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/secrets/#{secret_name}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Create or update an organization secret @see https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret """ def create_or_update_org_secret(org, secret_name, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Create or update a repository secret @see https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret """ def create_or_update_repo_secret(secret_name, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/secrets/#{secret_name}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Create an organization variable @see https://docs.github.com/rest/actions/variables#create-an-organization-variable """ def create_org_variable(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Create a registration token for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization """ def create_registration_token_for_org(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/registration-token" body = body api_call(:post, url, body, Noizu.Github.AuthenticationToken, options) end @doc """ Create a registration token for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository """ def create_registration_token_for_repo(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/registration-token" body = body api_call(:post, url, body, Noizu.Github.AuthenticationToken, options) end @doc """ Create a remove token for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization """ def create_remove_token_for_org(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/remove-token" body = body api_call(:post, url, body, Noizu.Github.AuthenticationToken, options) end @doc """ Create a remove token for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository """ def create_remove_token_for_repo(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/remove-token" body = body api_call(:post, url, body, Noizu.Github.AuthenticationToken, options) end @doc """ Create a repository variable @see https://docs.github.com/rest/actions/variables#create-a-repository-variable """ def create_repo_variable(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/variables" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Create a self-hosted runner group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization """ def create_self_hosted_runner_group_for_org(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runner-groups" body = body api_call(:post, url, body, Noizu.Github.RunnerGroupsOrg, options) end @doc """ Create a workflow dispatch event @see https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event """ def create_workflow_dispatch(workflow_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/workflows/#{workflow_id}/dispatches" body = body api_call(:post, url, body, Noizu.Github.WorkflowDispatchResponse, options) end @doc """ Delete a GitHub Actions cache for a repository (using a cache ID) @see https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id """ def delete_actions_cache_by_id(cache_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/caches/#{cache_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete GitHub Actions caches for a repository (using a cache key) @see https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key """ def delete_actions_cache_by_key(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:key, options, nil), get_field(:ref, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/caches" <> qs ) body = %{} api_call(:delete, url, body, Noizu.Github.ActionsCacheList, options) end @doc """ Delete an artifact @see https://docs.github.com/rest/actions/artifacts#delete-an-artifact """ def delete_artifact(artifact_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/artifacts/#{artifact_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a custom image from the organization @see https://docs.github.com/rest/actions/hosted-runners#delete-a-custom-image-from-the-organization """ def delete_custom_image_from_org(org, image_definition_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/custom/#{image_definition_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete an image version of custom image from the organization @see https://docs.github.com/rest/actions/hosted-runners#delete-an-image-version-of-custom-image-from-the-organization """ def delete_custom_image_version_from_org(org, image_definition_id, version, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/custom/#{image_definition_id}/versions/#{version}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete an environment secret @see https://docs.github.com/rest/actions/secrets#delete-an-environment-secret """ def delete_environment_secret(environment_name, secret_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/secrets/#{secret_name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete an environment variable @see https://docs.github.com/rest/actions/variables#delete-an-environment-variable """ def delete_environment_variable(name, environment_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/variables/#{name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a GitHub-hosted runner for an organization @see https://docs.github.com/rest/actions/hosted-runners#delete-a-github-hosted-runner-for-an-organization """ def delete_hosted_runner_for_org(org, hosted_runner_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/#{hosted_runner_id}" body = %{} api_call(:delete, url, body, Noizu.Github.ActionsHostedRunner, options) end @doc """ Delete an organization secret @see https://docs.github.com/rest/actions/secrets#delete-an-organization-secret """ def delete_org_secret(org, secret_name, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete an organization variable @see https://docs.github.com/rest/actions/variables#delete-an-organization-variable """ def delete_org_variable(org, name, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables/#{name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a repository secret @see https://docs.github.com/rest/actions/secrets#delete-a-repository-secret """ def delete_repo_secret(secret_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/secrets/#{secret_name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a repository variable @see https://docs.github.com/rest/actions/variables#delete-a-repository-variable """ def delete_repo_variable(name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/variables/#{name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a self-hosted runner from an organization @see https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization """ def delete_self_hosted_runner_from_org(org, runner_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a self-hosted runner from a repository @see https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository """ def delete_self_hosted_runner_from_repo(runner_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a self-hosted runner group from an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization """ def delete_self_hosted_runner_group_from_org(org, runner_group_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a workflow run @see https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run """ def delete_workflow_run(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete workflow run logs @see https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs """ def delete_workflow_run_logs(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/logs" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Disable a selected repository for GitHub Actions in an organization @see https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization """ def disable_selected_repository_github_actions_organization(org, repository_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/repositories/#{repository_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove a repository from the list of repositories allowed to use self-hosted runners in an organization @see https://docs.github.com/rest/actions/permissions#remove-a-repository-from-the-list-of-repositories-allowed-to-use-self-hosted-runners-in-an-organization """ def disable_selected_repository_self_hosted_runners_organization( org, repository_id, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/permissions/self-hosted-runners/repositories/#{repository_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Disable a workflow @see https://docs.github.com/rest/actions/workflows#disable-a-workflow """ def disable_workflow(workflow_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/workflows/#{workflow_id}/disable" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Download an artifact @see https://docs.github.com/rest/actions/artifacts#download-an-artifact """ def download_artifact(artifact_id, archive_format, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/artifacts/#{artifact_id}/#{archive_format}" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Download job logs for a workflow run @see https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run """ def download_job_logs_for_workflow_run(job_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/jobs/#{job_id}/logs" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Download workflow run attempt logs @see https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs """ def download_workflow_run_attempt_logs(run_id, attempt_number, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/attempts/#{attempt_number}/logs" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Download workflow run logs @see https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs """ def download_workflow_run_logs(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/logs" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Enable a selected repository for GitHub Actions in an organization @see https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization """ def enable_selected_repository_github_actions_organization( org, repository_id, body, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/permissions/repositories/#{repository_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Add a repository to the list of repositories allowed to use self-hosted runners in an organization @see https://docs.github.com/rest/actions/permissions#add-a-repository-to-the-list-of-repositories-allowed-to-use-self-hosted-runners-in-an-organization """ def enable_selected_repository_self_hosted_runners_organization( org, repository_id, body, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/permissions/self-hosted-runners/repositories/#{repository_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Enable a workflow @see https://docs.github.com/rest/actions/workflows#enable-a-workflow """ def enable_workflow(workflow_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/workflows/#{workflow_id}/enable" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Force cancel a workflow run @see https://docs.github.com/rest/actions/workflow-runs#force-cancel-a-workflow-run """ def force_cancel_workflow_run(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/force-cancel" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Create configuration for a just-in-time runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization """ def generate_runner_jitconfig_for_org(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/generate-jitconfig" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Create configuration for a just-in-time runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository """ def generate_runner_jitconfig_for_repo(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/generate-jitconfig" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ List GitHub Actions caches for a repository @see https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository """ def get_actions_cache_list(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil), get_field(:ref, options, nil), get_field(:key, options, nil), get_field(:sort, options, nil), get_field(:direction, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/caches" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheList, options) end @doc """ Get GitHub Actions cache retention limit for an enterprise @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-retention-limit-for-an-enterprise """ def get_actions_cache_retention_limit_for_enterprise(enterprise, options \\ nil) do url = github_base() <> "/enterprises/#{enterprise}/actions/cache/retention-limit" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheRetentionLimitForEnterprise, options) end @doc """ Get GitHub Actions cache retention limit for an organization @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-retention-limit-for-an-organization """ def get_actions_cache_retention_limit_for_organization(org, options \\ nil) do url = github_base() <> "/organizations/#{org}/actions/cache/retention-limit" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheRetentionLimitForOrganization, options) end @doc """ Get GitHub Actions cache retention limit for a repository @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-retention-limit-for-a-repository """ def get_actions_cache_retention_limit_for_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/cache/retention-limit" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheRetentionLimitForRepository, options) end @doc """ Get GitHub Actions cache storage limit for an enterprise @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-storage-limit-for-an-enterprise """ def get_actions_cache_storage_limit_for_enterprise(enterprise, options \\ nil) do url = github_base() <> "/enterprises/#{enterprise}/actions/cache/storage-limit" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheStorageLimitForEnterprise, options) end @doc """ Get GitHub Actions cache storage limit for an organization @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-storage-limit-for-an-organization """ def get_actions_cache_storage_limit_for_organization(org, options \\ nil) do url = github_base() <> "/organizations/#{org}/actions/cache/storage-limit" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheStorageLimitForOrganization, options) end @doc """ Get GitHub Actions cache storage limit for a repository @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-storage-limit-for-a-repository """ def get_actions_cache_storage_limit_for_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/cache/storage-limit" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheStorageLimitForRepository, options) end @doc """ Get GitHub Actions cache usage for a repository @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository """ def get_actions_cache_usage(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/cache/usage" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheUsageByRepository, options) end @doc """ List repositories with GitHub Actions cache usage for an organization @see https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization """ def get_actions_cache_usage_by_repo_for_org(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/cache/usage-by-repository" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Get GitHub Actions cache usage for an organization @see https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization """ def get_actions_cache_usage_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/cache/usage" body = %{} api_call(:get, url, body, Noizu.Github.ActionsCacheUsageOrgEnterprise, options) end @doc """ Get allowed actions and reusable workflows for an organization @see https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization """ def get_allowed_actions_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/selected-actions" body = %{} api_call(:get, url, body, Noizu.Github.SelectedActions, options) end @doc """ Get allowed actions and reusable workflows for a repository @see https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository """ def get_allowed_actions_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/selected-actions" body = %{} api_call(:get, url, body, Noizu.Github.SelectedActions, options) end @doc """ Get an artifact @see https://docs.github.com/rest/actions/artifacts#get-an-artifact """ def get_artifact(artifact_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/artifacts/#{artifact_id}" body = %{} api_call(:get, url, body, Noizu.Github.Artifact, options) end @doc """ Get artifact and log retention settings for an organization @see https://docs.github.com/rest/actions/permissions#get-artifact-and-log-retention-settings-for-an-organization """ def get_artifact_and_log_retention_settings_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/artifact-and-log-retention" body = %{} api_call(:get, url, body, Noizu.Github.ActionsArtifactAndLogRetentionResponse, options) end @doc """ Get artifact and log retention settings for a repository @see https://docs.github.com/rest/actions/permissions#get-artifact-and-log-retention-settings-for-a-repository """ def get_artifact_and_log_retention_settings_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/artifact-and-log-retention" body = %{} api_call(:get, url, body, Noizu.Github.ActionsArtifactAndLogRetentionResponse, options) end @doc """ Get a concurrency group for a repository @see https://docs.github.com/rest/actions/concurrency-groups#get-a-concurrency-group-for-a-repository """ def get_concurrency_group_for_repository(concurrency_group_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:ahead_of_run, options, nil), get_field(:ahead_of_job, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/concurrency_groups/#{concurrency_group_name}" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.ConcurrencyGroup, options) end @doc """ Get a custom image definition for GitHub Actions Hosted Runners @see https://docs.github.com/rest/actions/hosted-runners#get-a-custom-image-definition-for-github-actions-hosted-runners """ def get_custom_image_for_org(org, image_definition_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/custom/#{image_definition_id}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsHostedRunnerCustomImage, options) end @doc """ Get an image version of a custom image for GitHub Actions Hosted Runners @see https://docs.github.com/rest/actions/hosted-runners#get-an-image-version-of-a-custom-image-for-github-actions-hosted-runners """ def get_custom_image_version_for_org(org, image_definition_id, version, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/custom/#{image_definition_id}/versions/#{version}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsHostedRunnerCustomImageVersion, options) end @doc """ Get the customization template for an OIDC subject claim for a repository @see https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository """ def get_custom_oidc_sub_claim_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/oidc/customization/sub" body = %{} api_call(:get, url, body, Noizu.Github.OidcCustomSubRepo, options) end @doc """ Get an environment public key @see https://docs.github.com/rest/actions/secrets#get-an-environment-public-key """ def get_environment_public_key(environment_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/secrets/public-key" body = %{} api_call(:get, url, body, Noizu.Github.ActionsPublicKey, options) end @doc """ Get an environment secret @see https://docs.github.com/rest/actions/secrets#get-an-environment-secret """ def get_environment_secret(environment_name, secret_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/secrets/#{secret_name}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsSecret, options) end @doc """ Get an environment variable @see https://docs.github.com/rest/actions/variables#get-an-environment-variable """ def get_environment_variable(environment_name, name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/variables/#{name}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsVariable, options) end @doc """ Get fork PR contributor approval permissions for an organization @see https://docs.github.com/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-an-organization """ def get_fork_pr_contributor_approval_permissions_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/fork-pr-contributor-approval" body = %{} api_call(:get, url, body, Noizu.Github.ActionsForkPrContributorApproval, options) end @doc """ Get fork PR contributor approval permissions for a repository @see https://docs.github.com/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-a-repository """ def get_fork_pr_contributor_approval_permissions_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/fork-pr-contributor-approval" body = %{} api_call(:get, url, body, Noizu.Github.ActionsForkPrContributorApproval, options) end @doc """ Get default workflow permissions for an organization @see https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization """ def get_github_actions_default_workflow_permissions_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/workflow" body = %{} api_call(:get, url, body, Noizu.Github.ActionsGetDefaultWorkflowPermissions, options) end @doc """ Get default workflow permissions for a repository @see https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository """ def get_github_actions_default_workflow_permissions_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/workflow" body = %{} api_call(:get, url, body, Noizu.Github.ActionsGetDefaultWorkflowPermissions, options) end @doc """ Get GitHub Actions permissions for an organization @see https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization """ def get_github_actions_permissions_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions" body = %{} api_call(:get, url, body, Noizu.Github.ActionsOrganizationPermissions, options) end @doc """ Get GitHub Actions permissions for a repository @see https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository """ def get_github_actions_permissions_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions" body = %{} api_call(:get, url, body, Noizu.Github.ActionsRepositoryPermissions, options) end @doc """ Get a GitHub-hosted runner for an organization @see https://docs.github.com/rest/actions/hosted-runners#get-a-github-hosted-runner-for-an-organization """ def get_hosted_runner_for_org(org, hosted_runner_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/#{hosted_runner_id}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsHostedRunner, options) end @doc """ Get GitHub-owned images for GitHub-hosted runners in an organization @see https://docs.github.com/rest/actions/hosted-runners#get-github-owned-images-for-github-hosted-runners-in-an-organization """ def get_hosted_runners_github_owned_images_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/github-owned" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Get limits on GitHub-hosted runners for an organization @see https://docs.github.com/rest/actions/hosted-runners#get-limits-on-github-hosted-runners-for-an-organization """ def get_hosted_runners_limits_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/limits" body = %{} api_call(:get, url, body, Noizu.Github.ActionsHostedRunnerLimits, options) end @doc """ Get GitHub-hosted runners machine specs for an organization @see https://docs.github.com/rest/actions/hosted-runners#get-github-hosted-runners-machine-specs-for-an-organization """ def get_hosted_runners_machine_specs_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/machine-sizes" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Get partner images for GitHub-hosted runners in an organization @see https://docs.github.com/rest/actions/hosted-runners#get-partner-images-for-github-hosted-runners-in-an-organization """ def get_hosted_runners_partner_images_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/partner" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Get platforms for GitHub-hosted runners in an organization @see https://docs.github.com/rest/actions/hosted-runners#get-platforms-for-github-hosted-runners-in-an-organization """ def get_hosted_runners_platforms_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/platforms" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Get a job for a workflow run @see https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run """ def get_job_for_workflow_run(job_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/jobs/#{job_id}" body = %{} api_call(:get, url, body, Noizu.Github.Job, options) end @doc """ Get an organization public key @see https://docs.github.com/rest/actions/secrets#get-an-organization-public-key """ def get_org_public_key(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/public-key" body = %{} api_call(:get, url, body, Noizu.Github.ActionsPublicKey, options) end @doc """ Get an organization secret @see https://docs.github.com/rest/actions/secrets#get-an-organization-secret """ def get_org_secret(org, secret_name, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}" body = %{} api_call(:get, url, body, Noizu.Github.OrganizationActionsSecret, options) end @doc """ Get an organization variable @see https://docs.github.com/rest/actions/variables#get-an-organization-variable """ def get_org_variable(org, name, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables/#{name}" body = %{} api_call(:get, url, body, Noizu.Github.OrganizationActionsVariable, options) end @doc """ Get pending deployments for a workflow run @see https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run """ def get_pending_deployments_for_run(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/pending_deployments" body = %{} api_call(:get, url, body, Noizu.Github.Collection.PendingDeployment, options) end @doc """ Get private repo fork PR workflow settings for an organization @see https://docs.github.com/rest/actions/permissions#get-private-repo-fork-pr-workflow-settings-for-an-organization """ def get_private_repo_fork_pr_workflows_settings_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/fork-pr-workflows-private-repos" body = %{} api_call(:get, url, body, Noizu.Github.ActionsForkPrWorkflowsPrivateRepos, options) end @doc """ Get private repo fork PR workflow settings for a repository @see https://docs.github.com/rest/actions/permissions#get-private-repo-fork-pr-workflow-settings-for-a-repository """ def get_private_repo_fork_pr_workflows_settings_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/fork-pr-workflows-private-repos" body = %{} api_call(:get, url, body, Noizu.Github.ActionsForkPrWorkflowsPrivateRepos, options) end @doc """ Get a repository public key @see https://docs.github.com/rest/actions/secrets#get-a-repository-public-key """ def get_repo_public_key(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/secrets/public-key" body = %{} api_call(:get, url, body, Noizu.Github.ActionsPublicKey, options) end @doc """ Get a repository secret @see https://docs.github.com/rest/actions/secrets#get-a-repository-secret """ def get_repo_secret(secret_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/secrets/#{secret_name}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsSecret, options) end @doc """ Get a repository variable @see https://docs.github.com/rest/actions/variables#get-a-repository-variable """ def get_repo_variable(name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/variables/#{name}" body = %{} api_call(:get, url, body, Noizu.Github.ActionsVariable, options) end @doc """ Get the review history for a workflow run @see https://docs.github.com/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run """ def get_reviews_for_run(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/approvals" body = %{} api_call(:get, url, body, Noizu.Github.Collection.EnvironmentApprovals, options) end @doc """ Get a self-hosted runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization """ def get_self_hosted_runner_for_org(org, runner_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}" body = %{} api_call(:get, url, body, Noizu.Github.Runner, options) end @doc """ Get a self-hosted runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository """ def get_self_hosted_runner_for_repo(runner_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}" body = %{} api_call(:get, url, body, Noizu.Github.Runner, options) end @doc """ Get a self-hosted runner group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization """ def get_self_hosted_runner_group_for_org(org, runner_group_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}" body = %{} api_call(:get, url, body, Noizu.Github.RunnerGroupsOrg, options) end @doc """ Get self-hosted runners settings for an organization @see https://docs.github.com/rest/actions/permissions#get-self-hosted-runners-settings-for-an-organization """ def get_self_hosted_runners_permissions_organization(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/self-hosted-runners" body = %{} api_call(:get, url, body, Noizu.Github.SelfHostedRunnersSettings, options) end @doc """ Get a workflow @see https://docs.github.com/rest/actions/workflows#get-a-workflow """ def get_workflow(workflow_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/workflows/#{workflow_id}" body = %{} api_call(:get, url, body, Noizu.Github.Workflow, options) end @doc """ Get the level of access for workflows outside of the repository @see https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository """ def get_workflow_access_to_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/access" body = %{} api_call(:get, url, body, Noizu.Github.ActionsWorkflowAccessToRepository, options) end @doc """ Get a workflow run @see https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run """ def get_workflow_run(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:exclude_pull_requests, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.WorkflowRun, options) end @doc """ Get a workflow run attempt @see https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt """ def get_workflow_run_attempt(run_id, attempt_number, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:exclude_pull_requests, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/attempts/#{attempt_number}" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.WorkflowRun, options) end @doc """ Get workflow run usage @see https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage """ def get_workflow_run_usage(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/timing" body = %{} api_call(:get, url, body, Noizu.Github.WorkflowRunUsage, options) end @doc """ Get workflow usage @see https://docs.github.com/rest/actions/workflows#get-workflow-usage """ def get_workflow_usage(workflow_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/workflows/#{workflow_id}/timing" body = %{} api_call(:get, url, body, Noizu.Github.WorkflowUsage, options) end @doc """ List artifacts for a repository @see https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository """ def list_artifacts_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil), get_field(:name, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/artifacts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List concurrency groups for a repository @see https://docs.github.com/rest/actions/concurrency-groups#list-concurrency-groups-for-a-repository """ def list_concurrency_groups_for_repository(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:after, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/concurrency_groups" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.ConcurrencyGroupList, options) end @doc """ List concurrency groups for a workflow run @see https://docs.github.com/rest/actions/concurrency-groups#list-concurrency-groups-for-a-workflow-run """ def list_concurrency_groups_for_workflow_run(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:before, options, nil), get_field(:after, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/concurrency_groups" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.ConcurrencyGroupRunList, options) end @doc """ List image versions of a custom image for an organization @see https://docs.github.com/rest/actions/hosted-runners#list-image-versions-of-a-custom-image-for-an-organization """ def list_custom_image_versions_for_org(image_definition_id, org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/custom/#{image_definition_id}/versions" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List custom images for an organization @see https://docs.github.com/rest/actions/hosted-runners#list-custom-images-for-an-organization """ def list_custom_images_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/images/custom" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List environment secrets @see https://docs.github.com/rest/actions/secrets#list-environment-secrets """ def list_environment_secrets(environment_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/secrets" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List environment variables @see https://docs.github.com/rest/actions/variables#list-environment-variables """ def list_environment_variables(environment_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/variables" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List GitHub-hosted runners in a group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#list-github-hosted-runners-in-a-group-for-an-organization """ def list_github_hosted_runners_in_group_for_org(org, runner_group_id, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/hosted-runners" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List GitHub-hosted runners for an organization @see https://docs.github.com/rest/actions/hosted-runners#list-github-hosted-runners-for-an-organization """ def list_hosted_runners_for_org(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/hosted-runners" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List jobs for a workflow run @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run """ def list_jobs_for_workflow_run(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:filter, options, nil), get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/jobs" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List jobs for a workflow run attempt @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt """ def list_jobs_for_workflow_run_attempt(run_id, attempt_number, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/attempts/#{attempt_number}/jobs" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List labels for a self-hosted runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-organization """ def list_labels_for_self_hosted_runner_for_org(org, runner_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}/labels" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List labels for a self-hosted runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-a-repository """ def list_labels_for_self_hosted_runner_for_repo(runner_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}/labels" body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List organization secrets @see https://docs.github.com/rest/actions/secrets#list-organization-secrets """ def list_org_secrets(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/secrets" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List organization variables @see https://docs.github.com/rest/actions/variables#list-organization-variables """ def list_org_variables(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/variables" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository access to a self-hosted runner group in an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization """ def list_repo_access_to_self_hosted_runner_group_in_org(org, runner_group_id, options \\ nil) do url = ( query = [ get_field(:page, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/repositories" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository organization secrets @see https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets """ def list_repo_organization_secrets(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/organization-secrets" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository organization variables @see https://docs.github.com/rest/actions/variables#list-repository-organization-variables """ def list_repo_organization_variables(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/organization-variables" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository secrets @see https://docs.github.com/rest/actions/secrets#list-repository-secrets """ def list_repo_secrets(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/secrets" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository variables @see https://docs.github.com/rest/actions/variables#list-repository-variables """ def list_repo_variables(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/variables" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository workflows @see https://docs.github.com/rest/actions/workflows#list-repository-workflows """ def list_repo_workflows(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/workflows" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List runner applications for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization """ def list_runner_applications_for_org(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/downloads" body = %{} api_call(:get, url, body, Noizu.Github.Collection.RunnerApplication, options) end @doc """ List runner applications for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository """ def list_runner_applications_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/downloads" body = %{} api_call(:get, url, body, Noizu.Github.Collection.RunnerApplication, options) end @doc """ List selected repositories for an organization secret @see https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret """ def list_selected_repos_for_org_secret(org, secret_name, options \\ nil) do url = ( query = [ get_field(:page, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}/repositories" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List selected repositories for an organization variable @see https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable """ def list_selected_repos_for_org_variable(org, name, options \\ nil) do url = ( query = [ get_field(:page, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/variables/#{name}/repositories" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List selected repositories enabled for GitHub Actions in an organization @see https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization """ def list_selected_repositories_enabled_github_actions_organization(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/permissions/repositories" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repositories allowed to use self-hosted runners in an organization @see https://docs.github.com/rest/actions/permissions#list-repositories-allowed-to-use-self-hosted-runners-in-an-organization """ def list_selected_repositories_self_hosted_runners_organization(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/permissions/self-hosted-runners/repositories" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List self-hosted runner groups for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization """ def list_self_hosted_runner_groups_for_org(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil), get_field(:visible_to_repository, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/runner-groups" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List self-hosted runners for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization """ def list_self_hosted_runners_for_org(org, options \\ nil) do url = ( query = [ get_field(:name, options, nil), get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/runners" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List self-hosted runners for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository """ def list_self_hosted_runners_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:name, options, nil), get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runners" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List self-hosted runners in a group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization """ def list_self_hosted_runners_in_group_for_org(org, runner_group_id, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/runners" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List workflow run artifacts @see https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts """ def list_workflow_run_artifacts(run_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil), get_field(:name, options, nil), get_field(:direction, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/artifacts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List workflow runs for a workflow @see https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow """ def list_workflow_runs(workflow_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:actor, options, nil), get_field(:branch, options, nil), get_field(:event, options, nil), get_field(:status, options, nil), get_field(:per_page, options, nil), get_field(:page, options, nil), get_field(:created, options, nil), get_field(:exclude_pull_requests, options, nil), get_field(:check_suite_id, options, nil), get_field(:head_sha, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/workflows/#{workflow_id}/runs" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List workflow runs for a repository @see https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository """ def list_workflow_runs_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:actor, options, nil), get_field(:branch, options, nil), get_field(:event, options, nil), get_field(:status, options, nil), get_field(:per_page, options, nil), get_field(:page, options, nil), get_field(:created, options, nil), get_field(:exclude_pull_requests, options, nil), get_field(:check_suite_id, options, nil), get_field(:head_sha, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/actions/runs" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Re-run a job from a workflow run @see https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run """ def re_run_job_for_workflow_run(job_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/jobs/#{job_id}/rerun" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Re-run a workflow @see https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow """ def re_run_workflow(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/rerun" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Re-run failed jobs from a workflow run @see https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run """ def re_run_workflow_failed_jobs(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/rerun-failed-jobs" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Remove all custom labels from a self-hosted runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-organization """ def remove_all_custom_labels_from_self_hosted_runner_for_org(org, runner_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}/labels" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove all custom labels from a self-hosted runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-a-repository """ def remove_all_custom_labels_from_self_hosted_runner_for_repo(runner_id, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}/labels" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove a custom label from a self-hosted runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-organization """ def remove_custom_label_from_self_hosted_runner_for_org(org, runner_id, name, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}/labels/#{name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove a custom label from a self-hosted runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-a-repository """ def remove_custom_label_from_self_hosted_runner_for_repo(runner_id, name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}/labels/#{name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove repository access to a self-hosted runner group in an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization """ def remove_repo_access_to_self_hosted_runner_group_in_org( org, runner_group_id, repository_id, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/repositories/#{repository_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove selected repository from an organization secret @see https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret """ def remove_selected_repo_from_org_secret(org, secret_name, repository_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}/repositories/#{repository_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove selected repository from an organization variable @see https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable """ def remove_selected_repo_from_org_variable(org, name, repository_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables/#{name}/repositories/#{repository_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Remove a self-hosted runner from a group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization """ def remove_self_hosted_runner_from_group_for_org( org, runner_group_id, runner_id, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/runners/#{runner_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Review custom deployment protection rules for a workflow run @see https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run """ def review_custom_gates_for_run(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/deployment_protection_rule" body = body api_call(:post, url, body, Noizu.Github.Raw, options) end @doc """ Review pending deployments for a workflow run @see https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run """ def review_pending_deployments_for_run(run_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runs/#{run_id}/pending_deployments" body = body api_call(:post, url, body, Noizu.Github.Collection.Deployment, options) end @doc """ Set GitHub Actions cache retention limit for an enterprise @see https://docs.github.com/rest/actions/cache#set-github-actions-cache-retention-limit-for-an-enterprise """ def set_actions_cache_retention_limit_for_enterprise(enterprise, body, options \\ nil) do url = github_base() <> "/enterprises/#{enterprise}/actions/cache/retention-limit" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions cache retention limit for an organization @see https://docs.github.com/rest/actions/cache#set-github-actions-cache-retention-limit-for-an-organization """ def set_actions_cache_retention_limit_for_organization(org, body, options \\ nil) do url = github_base() <> "/organizations/#{org}/actions/cache/retention-limit" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions cache retention limit for a repository @see https://docs.github.com/rest/actions/cache#set-github-actions-cache-retention-limit-for-a-repository """ def set_actions_cache_retention_limit_for_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/cache/retention-limit" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions cache storage limit for an enterprise @see https://docs.github.com/rest/actions/cache#set-github-actions-cache-storage-limit-for-an-enterprise """ def set_actions_cache_storage_limit_for_enterprise(enterprise, body, options \\ nil) do url = github_base() <> "/enterprises/#{enterprise}/actions/cache/storage-limit" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions cache storage limit for an organization @see https://docs.github.com/rest/actions/cache#set-github-actions-cache-storage-limit-for-an-organization """ def set_actions_cache_storage_limit_for_organization(org, body, options \\ nil) do url = github_base() <> "/organizations/#{org}/actions/cache/storage-limit" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions cache storage limit for a repository @see https://docs.github.com/rest/actions/cache#set-github-actions-cache-storage-limit-for-a-repository """ def set_actions_cache_storage_limit_for_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/cache/storage-limit" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set allowed actions and reusable workflows for an organization @see https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization """ def set_allowed_actions_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/selected-actions" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set allowed actions and reusable workflows for a repository @see https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository """ def set_allowed_actions_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/selected-actions" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set artifact and log retention settings for an organization @see https://docs.github.com/rest/actions/permissions#set-artifact-and-log-retention-settings-for-an-organization """ def set_artifact_and_log_retention_settings_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/artifact-and-log-retention" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set artifact and log retention settings for a repository @see https://docs.github.com/rest/actions/permissions#set-artifact-and-log-retention-settings-for-a-repository """ def set_artifact_and_log_retention_settings_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/artifact-and-log-retention" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set custom labels for a self-hosted runner for an organization @see https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-organization """ def set_custom_labels_for_self_hosted_runner_for_org(org, runner_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runners/#{runner_id}/labels" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set custom labels for a self-hosted runner for a repository @see https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-a-repository """ def set_custom_labels_for_self_hosted_runner_for_repo(runner_id, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/runners/#{runner_id}/labels" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set the customization template for an OIDC subject claim for a repository @see https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository """ def set_custom_oidc_sub_claim_for_repo(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/oidc/customization/sub" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set fork PR contributor approval permissions for an organization @see https://docs.github.com/rest/actions/permissions#set-fork-pr-contributor-approval-permissions-for-an-organization """ def set_fork_pr_contributor_approval_permissions_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/fork-pr-contributor-approval" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set fork PR contributor approval permissions for a repository @see https://docs.github.com/rest/actions/permissions#set-fork-pr-contributor-approval-permissions-for-a-repository """ def set_fork_pr_contributor_approval_permissions_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/fork-pr-contributor-approval" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set default workflow permissions for an organization @see https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization """ def set_github_actions_default_workflow_permissions_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/workflow" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set default workflow permissions for a repository @see https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository """ def set_github_actions_default_workflow_permissions_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/workflow" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions permissions for an organization @see https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization """ def set_github_actions_permissions_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set GitHub Actions permissions for a repository @see https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository """ def set_github_actions_permissions_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set private repo fork PR workflow settings for an organization @see https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-an-organization """ def set_private_repo_fork_pr_workflows_settings_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/fork-pr-workflows-private-repos" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set private repo fork PR workflow settings for a repository @see https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-a-repository """ def set_private_repo_fork_pr_workflows_settings_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/fork-pr-workflows-private-repos" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set repository access for a self-hosted runner group in an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization """ def set_repo_access_to_self_hosted_runner_group_in_org( org, runner_group_id, body, options \\ nil ) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/repositories" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set selected repositories for an organization secret @see https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret """ def set_selected_repos_for_org_secret(org, secret_name, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/secrets/#{secret_name}/repositories" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set selected repositories for an organization variable @see https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable """ def set_selected_repos_for_org_variable(org, name, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables/#{name}/repositories" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set selected repositories enabled for GitHub Actions in an organization @see https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization """ def set_selected_repositories_enabled_github_actions_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/repositories" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set repositories allowed to use self-hosted runners in an organization @see https://docs.github.com/rest/actions/permissions#set-repositories-allowed-to-use-self-hosted-runners-in-an-organization """ def set_selected_repositories_self_hosted_runners_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/self-hosted-runners/repositories" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set self-hosted runners in a group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization """ def set_self_hosted_runners_in_group_for_org(org, runner_group_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}/runners" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set self-hosted runners settings for an organization @see https://docs.github.com/rest/actions/permissions#set-self-hosted-runners-settings-for-an-organization """ def set_self_hosted_runners_permissions_organization(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/permissions/self-hosted-runners" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set the level of access for workflows outside of the repository @see https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository """ def set_workflow_access_to_repository(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/permissions/access" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Update an environment variable @see https://docs.github.com/rest/actions/variables#update-an-environment-variable """ def update_environment_variable(name, environment_name, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/environments/#{environment_name}/variables/#{name}" body = body api_call(:patch, url, body, Noizu.Github.Raw, options) end @doc """ Update a GitHub-hosted runner for an organization @see https://docs.github.com/rest/actions/hosted-runners#update-a-github-hosted-runner-for-an-organization """ def update_hosted_runner_for_org(org, hosted_runner_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/hosted-runners/#{hosted_runner_id}" body = body api_call(:patch, url, body, Noizu.Github.ActionsHostedRunner, options) end @doc """ Update an organization variable @see https://docs.github.com/rest/actions/variables#update-an-organization-variable """ def update_org_variable(org, name, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/variables/#{name}" body = body api_call(:patch, url, body, Noizu.Github.Raw, options) end @doc """ Update a repository variable @see https://docs.github.com/rest/actions/variables#update-a-repository-variable """ def update_repo_variable(name, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/actions/variables/#{name}" body = body api_call(:patch, url, body, Noizu.Github.Raw, options) end @doc """ Update a self-hosted runner group for an organization @see https://docs.github.com/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization """ def update_self_hosted_runner_group_for_org(org, runner_group_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/actions/runner-groups/#{runner_group_id}" body = body api_call(:patch, url, body, Noizu.Github.RunnerGroupsOrg, options) end end