I have 1 workflow that is triggered by 2 different events. However, it’s come to a point where I need to extend it for one of the triggers; it would still do the same thing, but for one of the triggers, it would perform some additional steps right after. How do I achieve something like this? I know I can just copy the workflow to a new file with the extended steps, but it’d be nice if I can reuse some part of a workflow spec without have to copy the actual spec.
That sounds like something you can do with
if: conditions either on steps or jobs using data from the
github context. If you just want to know about the event type you can use
github.event_name, if you need event details you’ll have to look into
Ah! I didn’t know there’s an
if conditional. That’s actually the first thing that came to mind but I didn’t bother to check for it because I thought it’d be weird for the workflow spec to have it because it’s a spec and it’s in YAML. I guess another lesson here is verify assumptions.
I think this could work. Thanks!