Skip to content

Commit

Permalink
feat(action_integration_test): Add condition to use token from secret…
Browse files Browse the repository at this point in the history
…s if available.
  • Loading branch information
Noahnc committed Nov 30, 2023
1 parent 0ea227c commit e99cc37
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/action_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit e99cc37

Please sign in to comment.