When creating a whole new Github Actions workflow for Doctor, I wanted to do as much as possible from one workflow and be able to limit specific actions depending on how it triggered.
I wanted my GitHub Actions to run on each push to the
main branch and run the tests on a schedule. Instead of creating two workflows, I wanted to use only one workflow and specify not to run my release step to npm when triggered on a
The condition for this is relatively easy. All you need to know is the
event type and the property name to use.
You can find all property names on the context and expression syntax for GitHub Actions. The one we need for the workflow is
You can find the event name values on the [events that trigger the workflows](Events that trigger workflows - GitHub Docs) page. In this case, the value is
The condition its implementation looks as follows:
This results in: