Don't run the cron scheduled tox github workflow on forks
Closed this issue · 0 comments
Note: Not really a bug (but didn't know where else to put it), more of an annoyance and not related to molecule itself but to the CI.
The following describes when to run the tox workflow in github actions
https://github.com/ansible-community/molecule/blob/6fdc8478662353ea8017d06f5027d8fc3e8d3ec8/.github/workflows/tox.yml#L3-L13
The cron schedule is triggered everywhere regardless of the actual repo. So it it also starts in each fork and most probably fails everywhere as it does in my current fork and sending mail alerts for failure if configured.
I see two problems with this:
- it is annoying for the owner of the fork
- it is consuming computing resources for somethings that does not need to happen at all
Reading a bit on the subject, it seems there is not yet any clean and straightforward way to fix that. The only workarround for the moment is to put a condition on each job in the workflow looking something like:
jobs:
build:
if: >-
(github.event_name == 'schedule' && github.repository == 'ansible-community/molecule')
|| (github.event_name != 'schedule')
which is definitively ugly and inefficient (needs to be repeated on each job in the workflow...)
There is a suggestion to enhance the schedule declaration with new keywords but it has not been picked-up nor answered yet.
I did not produce a PR as I feel the current workaround is not satisfactory. But I'm happy to do so. Just tell me.
Issue Type
- Bug report
Molecule and Ansible details
N/A: CI based
Molecule installation method (one of):
N/A: CI based
Ansible installation method (one of):
N/A: CI based
Detail any linters or test runners used:
None
Desired Behavior
The cron scheduled tox workflow does not run on forked repositories
Actual Behaviour
The cron scheduled tox workflow is running every day on forked repositories (and alerting for failure, at least on my fork)