Skip to content

Commit

Permalink
Steps/UploadCodeCoverage.yml: Conditionalize upload on codecov token …
Browse files Browse the repository at this point in the history
…presence

Some repos may not upload to codecov for various reasons. Those repos
won't set the code coverage token so conditionalize the upload steps
on the token.

Signed-off-by: Michael Kubacki <[email protected]>
  • Loading branch information
makubacki committed Nov 15, 2023
1 parent 61bd5b5 commit f3ebfda
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Steps/UploadCodeCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
##

parameters:
- name: codecov_token
displayName: Codecov.io Token
type: string
default: ''
- name: report_dir
displayName: Code Coverage Report
type: string
Expand All @@ -31,9 +27,11 @@ steps:
- script: |
pip install requests
displayName: Install Python Dependencies for Codecov Uploader
condition: ne(variables['CODECOV_TOKEN'], '')
- task: PythonScript@0
displayName: Download and Verify Codecov Uploader
condition: ne(variables['CODECOV_TOKEN'], '')
inputs:
scriptSource: inline
script: |
Expand Down Expand Up @@ -93,6 +91,7 @@ steps:
- task: PythonScript@0
displayName: Run Codecov Uploader ${{ parameters.flag }}
condition: ne(variables['CODECOV_TOKEN'], '')
env:
COV_FLAG: ${{ parameters.flag }}
REPORT_DIR: ${{ parameters.report_dir }}
Expand Down

0 comments on commit f3ebfda

Please sign in to comment.