更新提取請求 - AWS CodeCommit

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

更新提取請求

您可以通過推送提取請求的來源分支來使用進一步的代碼變更來更新提取請求。如需詳細資訊,請參閱 在中創建提交 AWS CodeCommit

您可以使用 AWS CodeCommit 主控台或 AWS CLI 來更新提取請求的標題或描述。您可能想要更新提取請求標題或描述,因為:

  • 其他使用者無法了解描述,或原始標題會誤導。

  • 您希望標頭或描述能反映對開啟中提取請求的來源分支進行的變更。

更新提取請求(主控台)

您可以使用 CodeCommit 主控台來更新 CodeCommit 儲存庫中提取請求的標題和描述。若要更新提取請求中的代碼,請推送提交至開啟中提取請求的來源分支。

  1. 開啟位於的 CodeCommit 主控台https://console.aws.amazon.com/codesuite/codecommit/home

  2. Repositories (儲存庫) 中,選擇您要更新提取請求所在儲存庫的名稱。

  3. 在導覽窗格中,選擇 Pull requests (提取請求)

  4. 依預設,會顯示所有開啟的提取請求清單。選擇您想要更新的開啟中提取請求。

  5. 在提取請求中,選擇 Details (詳細資訊),然後選擇 Edit details (編輯詳細資訊),以編輯標題或描述。

    注意

    您無法更新已關閉或合併的提取請求的標題或描述。

更新提取請求 (AWS CLI)

使用AWS CLI命令,請安裝AWS CLI。如需詳細資訊,請參閱 命令列參考

您可能也想要了解下列命令:

若要使用 AWS for WordPressAWS CLI來更新代碼提取儲存庫中的提取請求

  1. 若要更新儲存庫中提取請求的標題,請執行 update-pull-request-title 命令,指定:

    • 提取請求的 ID (使用 --pull-request-id 選項)。

    • 提取請求的標題 (使用 --title 選項)。

    例如,若要更新 ID 為 47 提取請求的標題:

    aws codecommit update-pull-request-title --pull-request-id 47 --title "Consolidation of global variables - updated review"

    如果此命令成功執行,您會看到類似如下的輸出產生:

    { "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": "dd8b26gr-EXAMPLE", "approvalRuleTemplateName": "2-approver-rule-for-main" }, "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.12, "description": "Review the latest changes and updates to the global variables. I have updated this request with some changes, including removing some unused variables.", "lastActivityDate": 1508372657.188, "pullRequestId": "47", "pullRequestStatus": "OPEN", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables - updated review" } }
  2. 若要更新提取請求的描述,請執行 update-pull-request-description 命令,指定:

    • 提取請求的 ID (使用 --pull-request-id 選項)。

    • 描述 (使用 --description 選項)。

    例如,若要更新 ID 為 47 提取請求的描述:

    aws codecommit update-pull-request-description --pull-request-id 47 --description "Updated the pull request to remove unused global variable."

    如果此命令成功執行,您會看到類似如下的輸出產生:

    { "pullRequest": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.155, "description": "Updated the pull request to remove unused global variable.", "lastActivityDate": 1508372423.204, "pullRequestId": "47", "pullRequestStatus": "OPEN", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }