Build the same workflow on push & nightly

I have a quite extensive workflow defined with many jobs inside it. I want to run it both when developers push to GitHub, and also on a nightly basis. How can I do this without duplicating all that YAML?

If I define a triggers element in the workflow it seems to disable building on push…

If you have blocks of repeated YAML, then you can mark it with a &reference. Then, where you need it, you can inject it with a *reference. This is a feature of YAML, not CircleCI. I use this a lot to keep my YAML documents short, maintainable and DRY.

See the Wikipedia page for YAML for examples.

1 Like

With regards to your schedule/push triggers, may we see your YAML, in a formatted block?

Thanks, YAML references kind of solved the problem for us.