Skip to main content

branches

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

Overview

Namebranches
TypeResource
Idgithub.repos.branches

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
namestring
commitobject
protectedboolean
protectionobjectBranch Protection (title: Branch Protection)
protection_urlstring (uri)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_branchesselectowner, repoprotected, per_page, page

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
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
protectedbooleanSetting to true returns only branches protected by branch protections or rulesets. When set to false, only unprotected branches are returned. Omitting this parameter returns all branches.

SELECT examples

Response

SELECT
name,
commit,
protected,
protection,
protection_url
FROM github.repos.branches
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND protected = '{{ protected }}'
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;