I tried to get the git commit message in jenkinsfile and prevent the build based on commit message.
env.GIT_COMMIT doesn't return the commit details in jenkinsfile.
How to get the git latest commit message and prevent the jenkins build if the commit message contains [ci skip] in it?

The build will pass when [ci skip] is provided in the last git log, but will not run the actual build code (the replacement to the first echo statement)