I'd like to access the commit message in a pipeline so I can use it to make decisions within a script. Is this possible?
Hi @joncanning,
Yes, you would need to use git log with the right commit given by the BITBUCKET_COMMIT variable.The command would something like:
git log --format=%B -n 1 $BITBUCKET_COMMIT
Example of a pipeline that creates a variable with the commit message:
pipelines: default: - step: script: - COMMIT_MESSAGE=`git log --format=%B -n 1 $BITBUCKET_COMMIT` - echo $COMMIT_MESSAGE
I hope that helps.
..
It's workaround - bitbucket CI should predefine the commit message in one of the variables every CI. (like other ci's do, github/gitlab)
It looks like you're new here. Sign in or register to get started.