Invoke Sismo Only When Needed

There has been times when I want to commit but did not want to run a Sismo CI cycle. I have modified my own post-commit git hook with an if clause so that whenever RUN_SISMO variable is 1 then the post-commit hook gets executed. Whenever The RUN_SISMO environment variable is not defined or different than 1 then Sismo is not executed. So for instance:

// It will commit --amend without executing sismo
RUN_SISMO=0 git commit --amend
// It will commit --amend without executing sismo
RUN_SISMO=1 git commit --am "my new commit"

We can also permanently set the RUN_SISMO environment variable just by doing:

// to set sismo into running mode
export RUN_SISMO=1
// to prevent sismo running
export RUN_SISMO=0

There were other –no-verify flags but that flag only works for pre-commit hooks and not for post-commits. So we have to use environmental variables. The next thing we would like to automate so that we can copy our post-commit hook everywhere is the name of the project build. The build name is currently hard coded into the post-commit hook and has to be changed every time we copy it into a new project folder as it is not set as a global hook. An idea would be to have sismo.config.php which does have the build name to do some sort of environment setting so that the post-commit hook would know the name of the build. Any suggestions?

Leave a Reply

Your email address will not be published. Required fields are marked *