✨ Automatically detect [skip ci] messages (and the like) in your last commit 🎉
When you include either a [skip ci]
or a [ci skip]
in your commit message, (most) CI systems understand it to mean, well, CI. This is generally useful when you’re updating non-code portions of the repo, such as documentation or when you’re fixing something irrelevant to the codebase.
However, if you’re like me, you might use git hooks (perhaps using husky
) to prevent bad code from being pushed in the first place by making tests run during pre-push
hook. This generally works great, but it still runs the tests even when you add a [skip ci]
to your commit message.
That’s where this tool comes in. Just call skip-ci
and you’ll be able to detect & skip whatever commands you’d like when you don’t want to run any tests. To see an example, just look at this repo’s .huskyrc.yml
!
npm i skip-ci -D
This package has ZERO dependencies!
skip-ci && "Skipping CI..." || echo "Running tests..."
Because we rely on a subrepo for testing the skip-ci
tool, when cloning, make sure you add the --recursive
flag.
Then, you can test skip-ci
(or more specifically, cli.js
) by running npm test
, which will go through each commit of the test repo (repo/
) and check that the tool recognizes [skip ci]
and [ci skip]
and returns the appropriate exit codes.
And don’t forget to npm i
when developing to install devDependencies
(mainly linting).
👤 Jane Jeon JaneJeon9719@gmail.com
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2022 Jane Jeon JaneJeon9719@gmail.com.
This project is LGPL licensed.
TL;DR: you are free to import and use this library “as-is” in your code, without needing to make your code source-available or to license it under the same license as this library; however, if you do change this library and you distribute it (directly or as part of your code consuming this library), please do contribute back any improvements for this library and this library alone.