

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

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

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

使用下列指示來參考 GitHub 輸出參數。

**參考 GitHub 輸出參數**

1. 完成「[匯出 GitHub 輸出參數](integrations-github-action-export.md)」中的步驟。

   GitHub 輸出參數現在可用於其他動作。

1. 請記下輸出參數`Variables`的值。它包含底線 (\$1)。

1. 使用下列語法參考輸出參數：

   ```
   ${action-name.output-name}
   ```

   取代：
   + *action-name* 與產生輸出參數的 CodeCatalyst **GitHub 動作**名稱 （請勿使用 GitHub 動作的 `name`或 `id`)。
   + *output-name* 以及您稍早記下的輸出參數`Variables`值。

   **範例**

   ```
   BuildActionB:
     Identifier: aws/build@v1
     Configuration:
       Steps:
         - Run: echo ${MyGitHubAction.random-color-generator_SELECTEDCOLOR}
   ```

**具有內容的範例**  
下列範例示範如何在 中設定`SELECTEDCOLOR`變數`GitHubActionA`、輸出變數，然後在 中參考變數`BuildActionB`。

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