Skip to main content

pull_requests

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

Overview

Namepull_requests
TypeResource
Idaws.codecommit.pull_requests

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
approval_rulesarrayThe approval rules applied to the pull request.
author_arnstringThe Amazon Resource Name (ARN) of the user who created the pull request.
client_request_tokenstringA unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter. If a request is received with the same parameters and a token is included, the request returns information about the initial request that used that token.
creation_datestring (date-time)The date and time the pull request was originally created, in timestamp format.
descriptionstringThe user-defined description of the pull request. This description can be used to clarify what should be reviewed and other details of the request.
last_activity_datestring (date-time)The day and time of the last user or system activity on the pull request, in timestamp format.
pull_request_idstringThe system-generated ID of the pull request.
pull_request_statusstringThe status of the pull request. Pull request status can only change from OPEN to CLOSED. (OPEN, CLOSED)
pull_request_targetsarrayThe targets of the pull request, including the source branch and destination branch for the pull request.
revision_idstringThe system-generated revision ID for the pull request.
title_stringThe user-defined title of the pull request. This title is displayed in the list of pull requests to other repository users.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_pull_requestselectregionGets information about a pull request in a specified repository.
list_pull_requestsselectregionReturns a list of pull requests for a specified repository. The return list can be refined by pull request status or pull request author ARN.
create_pull_request_approval_ruleinsertregion, pullRequestId, approvalRuleName, approvalRuleContentCreates an approval rule for a pull request.
create_pull_requestinsertregion, title, targetsCreates a pull request in the specified repository.
update_pull_request_approval_rule_contentupdateregion, pullRequestId, approvalRuleName, newRuleContentUpdates the structure of an approval rule created specifically for a pull request. For example, you can change the number of required approvers and the approval pool for approvers.
update_pull_request_descriptionupdateregion, pullRequestId, descriptionReplaces the contents of the description of a pull request.
update_pull_request_statusupdateregion, pullRequestId, pullRequestStatusUpdates the status of a pull request.
update_pull_request_titleupdateregion, pullRequestId, titleReplaces the title of a pull request.
delete_pull_request_approval_ruledeleteregionDeletes an approval rule from a specified pull request. Approval rules can be deleted from a pull request only if the pull request is open, and if the approval rule was created specifically for a pull request and not generated from an approval rule template associated with the repository where the pull request was created. You cannot delete an approval rule from a merged or closed pull request.
evaluate_pull_request_approval_rulesexecregion, pullRequestId, revisionIdEvaluates whether a pull request has met all the conditions specified in its associated approval rules.
merge_pull_request_by_fast_forwardexecregion, pullRequestId, repositoryNameAttempts to merge the source commit of a pull request into the specified destination branch for that pull request at the specified commit using the fast-forward merge strategy. If the merge is successful, it closes the pull request.
merge_pull_request_by_squashexecregion, pullRequestId, repositoryNameAttempts to merge the source commit of a pull request into the specified destination branch for that pull request at the specified commit using the squash merge strategy. If the merge is successful, it closes the pull request.
merge_pull_request_by_three_wayexecregion, pullRequestId, repositoryNameAttempts to merge the source commit of a pull request into the specified destination branch for that pull request at the specified commit using the three-way merge strategy. If the merge is successful, it closes the pull request.
override_pull_request_approval_rulesexecregion, pullRequestId, revisionId, overrideStatusSets aside (overrides) all approval rule requirements for a specified pull request.
post_comment_for_pull_requestexecregion, pullRequestId, repositoryName, beforeCommitId, afterCommitId, contentPosts a comment on a pull request.

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
regionstringAWS region (default: us-east-1)

SELECT examples

Gets information about a pull request in a specified repository.

SELECT
approval_rules,
author_arn,
client_request_token,
creation_date,
description,
last_activity_date,
pull_request_id,
pull_request_status,
pull_request_targets,
revision_id,
title_
FROM aws.codecommit.pull_requests
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates an approval rule for a pull request.

INSERT INTO aws.codecommit.pull_requests (
pullRequestId,
approvalRuleName,
approvalRuleContent,
region
)
SELECT
'{{ pullRequestId }}' /* required */,
'{{ approvalRuleName }}' /* required */,
'{{ approvalRuleContent }}' /* required */,
'{{ region }}'
RETURNING
approval_rule
;

UPDATE examples

Updates the structure of an approval rule created specifically for a pull request. For example, you can change the number of required approvers and the approval pool for approvers.

UPDATE aws.codecommit.pull_requests
SET
pullRequestId = '{{ pullRequestId }}',
approvalRuleName = '{{ approvalRuleName }}',
existingRuleContentSha256 = '{{ existingRuleContentSha256 }}',
newRuleContent = '{{ newRuleContent }}'
WHERE
region = '{{ region }}' --required
AND pullRequestId = '{{ pullRequestId }}' --required
AND approvalRuleName = '{{ approvalRuleName }}' --required
AND newRuleContent = '{{ newRuleContent }}' --required
RETURNING
approval_rule;

DELETE examples

Deletes an approval rule from a specified pull request. Approval rules can be deleted from a pull request only if the pull request is open, and if the approval rule was created specifically for a pull request and not generated from an approval rule template associated with the repository where the pull request was created. You cannot delete an approval rule from a merged or closed pull request.

DELETE FROM aws.codecommit.pull_requests
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Evaluates whether a pull request has met all the conditions specified in its associated approval rules.

EXEC aws.codecommit.pull_requests.evaluate_pull_request_approval_rules
@region='{{ region }}' --required
@@json=
'{
"pullRequestId": "{{ pullRequestId }}",
"revisionId": "{{ revisionId }}"
}'
;