Do not upload coverage results to Codecov when run in a fork #307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The coverage workflow always fails when I sync my fork because the upload to Codecov fails. Thus I want to disable the upload step unless running on the main repository.
I think I found a good workaround:
if: github.event.repository.fork == false
. It skipped the upload step when I did a test run from my fork.My only remaining doubt is what will happen in a Pull Request from a fork (like this one). If the coverage upload step runs for this PR, that is great, and we should merge this change. However, if the the coverage upload is skipped for this PR, I'll have to revert to the less generic
if: github.repository == 'Merck/simtrial'
Note that I also added the manual trigger
workflow_dispatch:
to make it easier to run the coverage workflow from a feature branch.