Skip to content

Commit

Permalink
Submit coverage to codacy only if secret is available (patroni#2528)
Browse files Browse the repository at this point in the history
If PR is open from the external GH repo secrets are not set due to security reasons. It makes codacy coverage report to fail.

Co-authored-by: Polina Bungina <[email protected]>
  • Loading branch information
CyberDem0n and hughcapet authored Jan 17, 2023
1 parent acecbe0 commit b75cd5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
tags:
- v.*

env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
SECRETS_AVAILABLE: ${{ secrets.CODACY_PROJECT_TOKEN != '' }}

jobs:
unit:
runs-on: ${{ fromJson('{"ubuntu":"ubuntu-20.04","windows":"windows-latest","macos":"macos-latest"}')[matrix.os] }}
Expand Down Expand Up @@ -147,8 +151,7 @@ jobs:
run: python -m coverage xml -o cobertura.xml
- name: Upload coverage to Codacy
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r cobertura.xml -l Python --partial
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: ${{ env.SECRETS_AVAILABLE == 'true' }}

coveralls-finish:
name: Finalize coveralls.io
Expand All @@ -167,5 +170,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: ${{ env.SECRETS_AVAILABLE == 'true' }}

0 comments on commit b75cd5a

Please sign in to comment.