Skip to main content

org_budgets

Creates, updates, deletes, gets or lists an org_budgets resource.

Overview

Nameorg_budgets
TypeResource
Idgithub.billing.org_budgets

Fields

The following fields are returned by SELECT queries:

Response when updating a budget

NameDatatypeDescription
idstringID of the budget.
budget_entity_namestringThe name of the entity to apply the budget to (example: octocat/hello-world)
budget_alertingobject
budget_amountintegerThe budget amount in whole dollars. For license-based products, this represents the number of licenses.
budget_product_skustringA single product or sku to apply the budget to. (example: actions_linux)
budget_scopestringThe type of scope for the budget (enterprise, organization, repository, cost_center) (example: enterprise)
budget_typestringThe type of pricing for the budget (ProductPricing) (example: ProductPricing)
prevent_further_usagebooleanWhether to prevent additional spending once the budget is exceeded

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_budget_orgselectorg, budget_id> [!NOTE]
> This endpoint is in public preview and is subject to change.

Gets a budget by ID. The authenticated user must be an organization admin or billing manager.
get_all_budgets_orgselectorgpage, per_page, scope> [!NOTE]
> This endpoint is in public preview and is subject to change.

Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager.
Each page returns up to 10 budgets.
update_budget_orgupdateorg, budget_id> [!NOTE]
> This endpoint is in public preview and is subject to change.

Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager.
delete_budget_orgdeleteorg, budget_id> [!NOTE]
> This endpoint is in public preview and is subject to change.

Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager.

Parameters

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

NameDatatypeDescription
budget_idstringThe ID corresponding to the budget.
orgstringThe organization name. The name is not case sensitive.
pageintegerThe page number of the results to fetch.
per_pageintegerThe number of results per page (max 10).
scopestringFilter budgets by scope type.

SELECT examples

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Gets a budget by ID. The authenticated user must be an organization admin or billing manager.

SELECT
id,
budget_entity_name,
budget_alerting,
budget_amount,
budget_product_sku,
budget_scope,
budget_type,
prevent_further_usage
FROM github.billing.org_budgets
WHERE org = '{{ org }}' -- required
AND budget_id = '{{ budget_id }}' -- required
;

UPDATE examples

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager.

UPDATE github.billing.org_budgets
SET
budget_amount = {{ budget_amount }},
prevent_further_usage = {{ prevent_further_usage }},
budget_alerting = '{{ budget_alerting }}',
budget_scope = '{{ budget_scope }}',
budget_entity_name = '{{ budget_entity_name }}',
budget_type = '{{ budget_type }}',
budget_product_sku = '{{ budget_product_sku }}'
WHERE
org = '{{ org }}' --required
AND budget_id = '{{ budget_id }}' --required
RETURNING
budget,
message;

DELETE examples

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager.

DELETE FROM github.billing.org_budgets
WHERE org = '{{ org }}' --required
AND budget_id = '{{ budget_id }}' --required
;