In the doctor
project, I try to do as much as possible in one GitHub Actions workflow. Having all logic in one workflow makes it more convenient but comes with a couple of complexities. Like, do you want to run each action for every type of commit/PR/…?
Why I want to skip actions/jobs in my workflow
I host the documentation on Vercel. Vercel manages its build processes. You can also choose to use the Vercel Action for deploying your sources, but having it on the Vercel platform itself is straightforward.
When I was working on the documentation, I thought it would be useless to go through a complete workflow run when only the documentation was touched. I thought this does not have to happen, so why not skip these actions/jobs on specific commits. That is why I specified to skip all jobs when my commit contains #docs
in the commit message.
InfoYou can use any text value that makes sense to you.
Skipping when commits contain a text value
If you want to skip your job or actions when the commit contains a specific text value in its commit message, all you have to do is add an if
condition. In this condition, you can use the contains
expression.
In the case of my #docs
commit messages, the expression looks as follows:
|
|
ImportantGood thing to note is that the
contains
function is not case sensitive for the value to check.
InfoYou can read more about the GitHub Actions expression syntax at context and expression syntax for GitHub Actions.
Happy automating