Skip to main content

head_commit_branches

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

Overview

Namehead_commit_branches
TypeResource
Idgithub.repos.head_commit_branches

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
namestring
commitobject
protectedboolean

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_branches_for_head_commitselectowner, repo, commit_shaProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch.

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
commit_shastringThe SHA of the commit.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.

SELECT examples

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch.

SELECT
name,
commit,
protected
FROM github.repos.head_commit_branches
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND commit_sha = '{{ commit_sha }}' -- required
;