Skip to main content

stacks

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

Overview

Namestacks
TypeResource
Idgithub.pulls.stacks

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
node_idstring
baseobject
created_atstring (date-time)
numberinteger
openbooleanWhether the stack has any open pull request. False when all pull requests are merged or closed.
pull_requestsarray
urlstring (uri)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectowner, repo, stack_numberGets a pull request stack by providing its stack number.
listselectowner, repopull_request, per_page, pageLists pull request stacks in a repository.
createinsertowner, repo, pull_requestsCreates a stack from an ordered list of pull request numbers. Provide the pull
request numbers from the bottom of the stack to the top. Each pull request's
base ref must match the previous pull request's head ref.
addexecowner, repo, stack_number, pull_requestsAppends an ordered list of pull request numbers onto the top of an existing
stack. Provide only the pull requests you want to add, from the current top of
the stack upward. The first new pull request's base ref must match the current
top pull request's head ref.
unstackexecowner, repo, stack_numberRemoves the unmerged pull requests from a stack. Pull requests that cannot be
unstacked (for example, those that are queued for merge) are left in place. When pull requests remain in the stack, the updated
stack is returned with a 200. When no pull requests remain, the stack is
dissolved and a 204 is returned.

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.
stack_numberintegerThe number that identifies the pull request stack.
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."
pull_requestintegerFilter to the stack containing this repository pull request number.

SELECT examples

Gets a pull request stack by providing its stack number.

SELECT
id,
node_id,
base,
created_at,
number,
open,
pull_requests,
url
FROM github.pulls.stacks
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND stack_number = '{{ stack_number }}' -- required
;

INSERT examples

Creates a stack from an ordered list of pull request numbers. Provide the pull
request numbers from the bottom of the stack to the top. Each pull request's
base ref must match the previous pull request's head ref.

INSERT INTO github.pulls.stacks (
pull_requests,
owner,
repo
)
SELECT
'{{ pull_requests }}' /* required */,
'{{ owner }}',
'{{ repo }}'
RETURNING
id,
node_id,
base,
created_at,
number,
open,
pull_requests,
url
;

Lifecycle Methods

Appends an ordered list of pull request numbers onto the top of an existing
stack. Provide only the pull requests you want to add, from the current top of
the stack upward. The first new pull request's base ref must match the current
top pull request's head ref.

EXEC github.pulls.stacks.add 
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@stack_number='{{ stack_number }}' --required
@@json=
'{
"pull_requests": "{{ pull_requests }}"
}'
;