Skip to main content

pull_requests

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

Overview

Namepull_requests
TypeResource
Idgoogle.securesourcemanager.pull_requests

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput only. A unique identifier for a PullRequest. The number appended at the end is generated by the server. Format: projects/{project}/locations/{location}/repositories/{repository}/pullRequests/{pull_request_id}
baseobjectRequired. The branch to merge changes in. (id: Branch)
bodystringOptional. The pull request body. Provides a detailed description of the changes.
closeTimestring (google-datetime)Output only. Close timestamp (if closed or merged). Cleared when pull request is re-opened.
createTimestring (google-datetime)Output only. Creation timestamp.
headobjectImmutable. The branch containing the changes to be merged. (id: Branch)
statestringOutput only. State of the pull request (open, closed or merged).
titlestringRequired. The pull request title.
updateTimestring (google-datetime)Output only. Last updated timestamp.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, repositoriesId, pullRequestsIdGets a pull request.
listselectprojectsId, locationsId, repositoriesIdpageSize, pageTokenLists pull requests in a repository.
createinsertprojectsId, locationsId, repositoriesIdCreates a pull request.
patchupdateprojectsId, locationsId, repositoriesId, pullRequestsIdupdateMaskUpdates a pull request.
mergeexecprojectsId, locationsId, repositoriesId, pullRequestsIdMerges a pull request.
openexecprojectsId, locationsId, repositoriesId, pullRequestsIdOpens a pull request.
closeexecprojectsId, locationsId, repositoriesId, pullRequestsIdCloses a pull request without merging.

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
locationsIdstring
projectsIdstring
pullRequestsIdstring
repositoriesIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a pull request.

SELECT
name,
base,
body,
closeTime,
createTime,
head,
state,
title,
updateTime
FROM google.securesourcemanager.pull_requests
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND pullRequestsId = '{{ pullRequestsId }}' -- required;

INSERT examples

Creates a pull request.

INSERT INTO google.securesourcemanager.pull_requests (
data__title,
data__body,
data__base,
data__head,
projectsId,
locationsId,
repositoriesId
)
SELECT
'{{ title }}',
'{{ body }}',
'{{ base }}',
'{{ head }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ repositoriesId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates a pull request.

UPDATE google.securesourcemanager.pull_requests
SET
data__title = '{{ title }}',
data__body = '{{ body }}',
data__base = '{{ base }}',
data__head = '{{ head }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND pullRequestsId = '{{ pullRequestsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;

Lifecycle Methods

Merges a pull request.

EXEC google.securesourcemanager.pull_requests.merge 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@repositoriesId='{{ repositoriesId }}' --required,
@pullRequestsId='{{ pullRequestsId }}' --required;