Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not upload coverage results to Codecov when run in a fork #307

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jdblischak
Copy link
Collaborator

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.

@jdblischak jdblischak self-assigned this Jan 20, 2025
@jdblischak
Copy link
Collaborator Author

Shoot. It didn't upload the coverage results (https://github.com/jdblischak/simtrial/actions/runs/12876137723/job/35898635722)

image

@jdblischak jdblischak force-pushed the no-cov-upload-from-fork branch from 1dcb2fe to e41efb4 Compare January 21, 2025 19:01
@jdblischak jdblischak force-pushed the no-cov-upload-from-fork branch from e41efb4 to 0131f27 Compare January 21, 2025 19:13
@nanxstats
Copy link
Collaborator

Nice, @jdblischak do you think it's useful to also contribute this condition to upstream r-lib/actions once it's confirmed working? Feels to me like a fairly common use case that should be safeguarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants