From e99cc378879ffc3d84e6cbedbb2a3d8dd238bffb Mon Sep 17 00:00:00 2001 From: Noah Canadea Date: Thu, 30 Nov 2023 07:34:34 +0000 Subject: [PATCH] feat(action_integration_test): Add condition to use token from secrets if available. --- .github/workflows/action_integration_test.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/action_integration_test.yml b/.github/workflows/action_integration_test.yml index 477a4dd..ca7c29b 100644 --- a/.github/workflows/action_integration_test.yml +++ b/.github/workflows/action_integration_test.yml @@ -14,6 +14,20 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Evaluate token to use + id: token + shell: bash + run: | + # Check if the secrets.PAT_GITHUB is set, if not use the default GITHUB_TOKEN + if [ "${{ secrets.PAT_GITHUB }}" != "" ]; then + echo "Secret PAT_GITHUB is set, using it instead of GITHUB_TOKEN" + echo "::set-output name=token::${{ secrets.PAT_GITHUB }}" + else + echo "Secret PAT_GITHUB is not set, actions default token GITHUB_TOKEN" + echo "::set-output name=token::${{ github.token }}" + fi + fi + - name: Run in report only mode uses: ./ with: @@ -25,7 +39,7 @@ jobs: with: report_only: false target_branch_name: "feat/infrapatch_test_${{ github.run_number }}" - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ steps.token.outputs.token }} - name: Check update result shell: pwsh