Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Commit message

joncanning October 14, 2019

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?

2 answers

1 accepted

6 votes
Answer accepted
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2019

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.

David Tayar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 6, 2024

It's workaround - bitbucket CI should predefine the commit message in one of the variables every CI. (like other ci's do, github/gitlab)

Like Peter Khoa likes this
0 votes
Nikolay Georgiev
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 24, 2024

..

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events