This feature is already available on GitHub Actions. However, you could use this guide to make your own skip tags.
GitHub Actions doesn't support skipping builds with [skip ci] like CircleCI, for example. But here's the magic trick:
jobs:
build:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[ci skip]')"
This snippet allows you to any custom filter you need. For example, I like to use:
jobs:
build:
runs-on: ubuntu-latest
if: "contains(toJSON(github.event.head_commit.message), '[build]')"
Only triggers the action if [build]
is found in some pushed commit comment, like a manual trigger.
Top comments (2)
Since I just had troubles using this, a quick reminder: the code above will check all commits in
github.event.commits
(which could be more than just the latest commit!) for[skip ci]
. Therefore a workflow was skipped with a commit not having[skip ci]
in the commit message, which was not intended...If you want to just check the latest commit, change it to:
Thank you!.
This change has already been added to the original post.