A maintenance workflow must run automatically every night at 02:00 UTC to prune stale caches, with no human starting it and no code change needed to fire it. Which trigger should be configured at the top of the workflow file?
on:
<trigger>:
- cron: '0 2 * * *'- Aschedule, because it accepts one or more cron expressions and triggers the workflow on the defined recurring time-based interval. Correct
- Bworkflow_dispatch, because a recurring nightly job is started from the Actions tab and the cron expression sets the default run time.
- Crepository_dispatch, because it listens for a timed webhook that GitHub emits internally to drive cron-based recurring runs.
- Dpush, because adding a cron filter under the push event tells GitHub to replay the last push on the recurring schedule.
Why A is correct: The schedule event takes a list of cron expressions evaluated against UTC, so '0 2 * * *' fires the workflow every night at 02:00 without any human action or code change.
Why B is wrong: Tempting because workflow_dispatch also appears under on, but it only enables a manual run button and accepts no cron field, so it cannot fire the job automatically at 02:00 UTC.
Why C is wrong: Tempting because repository_dispatch is also event driven, but it fires only when an external system posts a custom event to the API, not on any internal timer, so a cron field is ignored here.
Why D is wrong: Tempting because push is a very common trigger, but it fires only when commits are pushed and supports no cron field, so it cannot produce a nightly time-based run.