CI: Prevent cron job workflow runs on forks #3468
Open
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.
This PR implements conditions to CI actions to prevent scheduled cron job actions from running on forks to resolve #3457
Changes
This allows normal push, pull_request, tag, and manual triggers to continue working on forks (still useful for testing PRs), while completely skipping scheduled runs on any fork. I also left a comment in the workflows for anyone that wants to enable the workflows on their forks.
I applied this to the following workflows:
.github/workflows/ci_crontests.yml.github/workflows/ci_devtest.yml.github/workflows/ci_tests.yml(both the tests and egg_info jobs).github/workflows/ci-online-crontests.ymlleft it alone as it already usesgithub.repository == 'astropy/astroquery'condition.Also, I know that this was not covered in the issue ticket, but I also applied a condition to the codeql workflow since I looked at my fork and it was running on a schedule there too.
I restricted to the upstream repository only using the stricter condition
if: github.repository == 'astropy/astroquery'since the results from forks are ignored by GitHub anyway, so its kinda just a waste.I'm not sure if this requires a changelog entry. I tried looking at some closed infra/CI PRs and many were marked with a "no-changelog-needed" tag, so I won't include one for now, but can add one if its needed.
Also can make similar changes to astropy/pyvo#705 if that would be helpful @bsipocz.
Hope this is a helpful ! 😄