

Amazon CodeCatalyst 不再向新客戶開放。現有客戶可以繼續正常使用該服務。如需詳細資訊，請參閱[如何從 CodeCatalyst 遷移](migration.md)。

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

# 匯出 GitHub 輸出參數
<a name="integrations-github-action-export"></a>

您可以在 CodeCatalyst 工作流程中使用 [GitHub 輸出參數](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter)。

**注意**  
*輸出參數*的另一個單字是*可變*的。由於 GitHub 在其文件中使用 術語*輸出參數*，因此我們也會使用此術語。

使用下列指示從 GitHub 動作匯出 GitHub 輸出參數，以便供其他 CodeCatalyst 工作流程動作使用。

**匯出 GitHub 輸出參數**

1. 開啟工作流程，然後選擇**編輯**。如需詳細資訊，請參閱[建立工作流程](workflows-create-workflow.md)。

1. 在產生您要匯出的輸出參數的 **GitHub 動作**動作中，新增具有如下所示之基礎`Variables`屬性的 `Outputs`區段：

   ```
   Actions:
     MyGitHubAction:
       Identifier: aws/github-actions-runner@v1
       Outputs:
         Variables:
           - 'step-id_output-name'
   ```

   取代：
   + *step-id*，其值為 GitHub 動作`steps`區段中的 `id:` 屬性。
   + *output-name* 與 GitHub 輸出參數的名稱。

**範例**  
下列範例說明如何匯出名為 的 GitHub 輸出參數`SELECTEDCOLOR`。

   ```
   Actions:
     MyGitHubAction:
       Identifier: aws/github-actions-runner@v1
       Outputs:
         Variables:
           - 'random-color-generator_SELECTEDCOLOR'
       Configuration:
         Steps:
           - name: Set selected color
             run: echo "SELECTEDCOLOR=green" >> $GITHUB_OUTPUT
             id: random-color-generator
   ```