pull_requests
Creates, updates, deletes, gets or lists a pull_requests resource.
Overview
| Name | pull_requests |
| Type | Resource |
| Id | aws.codecommit.pull_requests |
Fields
The following fields are returned by SELECT queries:
- get_pull_request
- list_pull_requests
| Name | Datatype | Description |
|---|---|---|
approval_rules | array | The approval rules applied to the pull request. |
author_arn | string | The Amazon Resource Name (ARN) of the user who created the pull request. |
client_request_token | string | A 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_date | string (date-time) | The date and time the pull request was originally created, in timestamp format. |
description | string | The 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_date | string (date-time) | The day and time of the last user or system activity on the pull request, in timestamp format. |
pull_request_id | string | The system-generated ID of the pull request. |
pull_request_status | string | The status of the pull request. Pull request status can only change from OPEN to CLOSED. (OPEN, CLOSED) |
pull_request_targets | array | The targets of the pull request, including the source branch and destination branch for the pull request. |
revision_id | string | The system-generated revision ID for the pull request. |
title_ | string | The user-defined title of the pull request. This title is displayed in the list of pull requests to other repository users. |
| Name | Datatype | Description |
|---|---|---|
pull_request_id | string | The system-generated IDs of the pull requests. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_pull_request | select | region | Gets information about a pull request in a specified repository. | |
list_pull_requests | select | region | Returns 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_rule | insert | region, pullRequestId, approvalRuleName, approvalRuleContent | Creates an approval rule for a pull request. | |
create_pull_request | insert | region, title, targets | Creates a pull request in the specified repository. | |
update_pull_request_approval_rule_content | update | region, pullRequestId, approvalRuleName, newRuleContent | 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_pull_request_description | update | region, pullRequestId, description | Replaces the contents of the description of a pull request. | |
update_pull_request_status | update | region, pullRequestId, pullRequestStatus | Updates the status of a pull request. | |
update_pull_request_title | update | region, pullRequestId, title | Replaces the title of a pull request. | |
delete_pull_request_approval_rule | delete | region | 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. | |
evaluate_pull_request_approval_rules | exec | region, pullRequestId, revisionId | Evaluates whether a pull request has met all the conditions specified in its associated approval rules. | |
merge_pull_request_by_fast_forward | exec | region, pullRequestId, repositoryName | Attempts 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_squash | exec | region, pullRequestId, repositoryName | Attempts 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_way | exec | region, pullRequestId, repositoryName | Attempts 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_rules | exec | region, pullRequestId, revisionId, overrideStatus | Sets aside (overrides) all approval rule requirements for a specified pull request. | |
post_comment_for_pull_request | exec | region, pullRequestId, repositoryName, beforeCommitId, afterCommitId, content | Posts 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_pull_request
- list_pull_requests
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
;
Returns a list of pull requests for a specified repository. The return list can be refined by pull request status or pull request author ARN.
SELECT
pull_request_id
FROM aws.codecommit.pull_requests
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_pull_request_approval_rule
- create_pull_request
- Manifest
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
;
Creates a pull request in the specified repository.
INSERT INTO aws.codecommit.pull_requests (
title,
description,
targets,
clientRequestToken,
region
)
SELECT
'{{ title }}' /* required */,
'{{ description }}',
'{{ targets }}' /* required */,
'{{ clientRequestToken }}',
'{{ region }}'
RETURNING
pull_request
;
# Description fields are for documentation purposes
- name: pull_requests
props:
- name: region
value: "{{ region }}"
description: Required parameter for the pull_requests resource.
- name: pullRequestId
value: "{{ pullRequestId }}"
description: |
The system-generated ID of the pull request for which you want to create the approval rule.
- name: approvalRuleName
value: "{{ approvalRuleName }}"
description: |
The name for the approval rule.
- name: approvalRuleContent
value: "{{ approvalRuleContent }}"
description: |
The content of the approval rule, including the number of approvals needed and the structure of an approval pool defined for approvals, if any. For more information about approval pools, see the CodeCommit User Guide. When you create the content of the approval rule, you can specify approvers in an approval pool in one of two ways: CodeCommitApprovers: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account 123456789012 and Mary_Major, all of the following would be counted as approvals coming from that user: An IAM user in the account (arn:aws:iam::123456789012:user/Mary_Major) A federated user identified in IAM as Mary_Major (arn:aws:sts::123456789012:federated-user/Mary_Major) This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of Mary_Major (arn:aws:sts::123456789012:assumed-role/CodeCommitReview/Mary_Major) unless you include a wildcard (*Mary_Major). Fully qualified ARN: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role. For more information about IAM ARNs, wildcards, and formats, see IAM Identifiers in the IAM User Guide.
- name: title
value: "{{ title }}"
description: |
The title of the pull request. This title is used to identify the pull request to other users in the repository.
- name: description
value: "{{ description }}"
description: |
A description of the pull request.
- name: targets
description: |
The targets for the pull request, including the source of the code to be reviewed (the source branch) and the destination where the creator of the pull request intends the code to be merged after the pull request is closed (the destination branch).
value:
- repositoryName: "{{ repositoryName }}"
sourceReference: "{{ sourceReference }}"
destinationReference: "{{ destinationReference }}"
- name: clientRequestToken
value: "{{ clientRequestToken }}"
description: |
A 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. The Amazon Web ServicesSDKs prepopulate client request tokens. If you are using an Amazon Web ServicesSDK, an idempotency token is created for you.
UPDATE examples
- update_pull_request_approval_rule_content
- update_pull_request_description
- update_pull_request_status
- update_pull_request_title
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;
Replaces the contents of the description of a pull request.
UPDATE aws.codecommit.pull_requests
SET
pullRequestId = '{{ pullRequestId }}',
description = '{{ description }}'
WHERE
region = '{{ region }}' --required
AND pullRequestId = '{{ pullRequestId }}' --required
AND description = '{{ description }}' --required
RETURNING
pull_request;
Updates the status of a pull request.
UPDATE aws.codecommit.pull_requests
SET
pullRequestId = '{{ pullRequestId }}',
pullRequestStatus = '{{ pullRequestStatus }}'
WHERE
region = '{{ region }}' --required
AND pullRequestId = '{{ pullRequestId }}' --required
AND pullRequestStatus = '{{ pullRequestStatus }}' --required
RETURNING
pull_request;
Replaces the title of a pull request.
UPDATE aws.codecommit.pull_requests
SET
pullRequestId = '{{ pullRequestId }}',
title = '{{ title }}'
WHERE
region = '{{ region }}' --required
AND pullRequestId = '{{ pullRequestId }}' --required
AND title = '{{ title }}' --required
RETURNING
pull_request;
DELETE examples
- delete_pull_request_approval_rule
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
- evaluate_pull_request_approval_rules
- merge_pull_request_by_fast_forward
- merge_pull_request_by_squash
- merge_pull_request_by_three_way
- override_pull_request_approval_rules
- post_comment_for_pull_request
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 }}"
}'
;
Attempts 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.
EXEC aws.codecommit.pull_requests.merge_pull_request_by_fast_forward
@region='{{ region }}' --required
@@json=
'{
"pullRequestId": "{{ pullRequestId }}",
"repositoryName": "{{ repositoryName }}",
"sourceCommitId": "{{ sourceCommitId }}"
}'
;
Attempts 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.
EXEC aws.codecommit.pull_requests.merge_pull_request_by_squash
@region='{{ region }}' --required
@@json=
'{
"pullRequestId": "{{ pullRequestId }}",
"repositoryName": "{{ repositoryName }}",
"sourceCommitId": "{{ sourceCommitId }}",
"conflictDetailLevel": "{{ conflictDetailLevel }}",
"conflictResolutionStrategy": "{{ conflictResolutionStrategy }}",
"commitMessage": "{{ commitMessage }}",
"authorName": "{{ authorName }}",
"email": "{{ email }}",
"keepEmptyFolders": {{ keepEmptyFolders }},
"conflictResolution": "{{ conflictResolution }}"
}'
;
Attempts 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.
EXEC aws.codecommit.pull_requests.merge_pull_request_by_three_way
@region='{{ region }}' --required
@@json=
'{
"pullRequestId": "{{ pullRequestId }}",
"repositoryName": "{{ repositoryName }}",
"sourceCommitId": "{{ sourceCommitId }}",
"conflictDetailLevel": "{{ conflictDetailLevel }}",
"conflictResolutionStrategy": "{{ conflictResolutionStrategy }}",
"commitMessage": "{{ commitMessage }}",
"authorName": "{{ authorName }}",
"email": "{{ email }}",
"keepEmptyFolders": {{ keepEmptyFolders }},
"conflictResolution": "{{ conflictResolution }}"
}'
;
Sets aside (overrides) all approval rule requirements for a specified pull request.
EXEC aws.codecommit.pull_requests.override_pull_request_approval_rules
@region='{{ region }}' --required
@@json=
'{
"pullRequestId": "{{ pullRequestId }}",
"revisionId": "{{ revisionId }}",
"overrideStatus": "{{ overrideStatus }}"
}'
;
Posts a comment on a pull request.
EXEC aws.codecommit.pull_requests.post_comment_for_pull_request
@region='{{ region }}' --required
@@json=
'{
"pullRequestId": "{{ pullRequestId }}",
"repositoryName": "{{ repositoryName }}",
"beforeCommitId": "{{ beforeCommitId }}",
"afterCommitId": "{{ afterCommitId }}",
"location": "{{ location }}",
"content": "{{ content }}",
"clientRequestToken": "{{ clientRequestToken }}"
}'
;