CmdID / aws / aws codecommit
aws codecommit create-pull-request
Creates a pull request in the specified repository. AWS CLI reference
1 example 4 options Its page in the AWS CLI reference
Examples
To create a pull request
The following create-pull-request example creates a pull request named 'Pronunciation difficulty analyzer' with a description of 'Please review these changes by Tuesday' that targets the 'jane-branch' source branch and is to be merged to the default branch 'main' in an AWS CodeCommit repository named 'MyDemoRepo'.
aws codecommit create-pull-request --title "My Pull Request" --description "Please review these changes by Tuesday" --client-request-token 123Example --targets repositoryName=MyDemoRepo,sourceReference=MyNewBranchIdentify--titleThe title of the pull request.--descriptionA description of the pull request.--client-request-tokenA unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter.--targetsThe 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).Its output, shortened
{
"pullRequest": {
"approvalRules": [
{
"approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}",
"approvalRuleId": "dd8b17fe-EXAMPLE",
"approvalRuleName": "2-approver-rule-for-main",
"creationDate": 1571356106.936,
"lastModifiedDate": 571356106.936,
"lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major",
"originApprovalRuleTemplate": {
"approvalRuleTemplateId": "dd3d22fe-EXAMPLE",
"approvalRuleTemplateName": "2-approver-rule-for-main"
},
"ruleContentSha256": "4711b576EXAMPLE"
}
],
"authorArn": "arn:aws:iam::123456789111:user/Jane_Doe",
"description": "Please review these changes by Tuesday",
"title": "Pronunciation difficulty analyzer",
"pullRequestTargets": [
{
"destinationCommit": "5d036259EXAMPLE",
"destinationReference": "refs/heads/main",
"repositoryName": "MyDemoRepo",
"sourceCommit": "317f8570EXAMPLE",
"sourceReference": "refs/heads/jane-branch",
"mergeMetadata": {
"isMerged": false
}
… 9 more linesFor more information, see Create a pull request in the AWS CodeCommit User Guide.
Options
--client-request-tokenA unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter.--descriptionA description of the pull request.--targetsThe 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).--titleThe title of the pull request.