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

is there an environment variable for getting the name of the person who committed?

Deleted user February 3, 2022

Hi, I am sending a slack notification from my pipeline. Following is my notification description. I use default environment variables in there to get information.

Pipeline no: #$BITBUCKET_BUILD_NUMBER, branch: $BITBUCKET_BRANCH, commit - $BITBUCKET_COMMIT

 I need to get the username of the person who did the commit also. is there an environment variable for that? Or any other way to get that?

 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 4, 2022

Hi @[deleted] and welcome to the community!

Bitbucket usernames are not exposed via variables, API, or in the UI, to comply with GDPR regulations.

There is no environment variable to get the name of the commit's author, but you can use a git command to get that information.

The following command will give you the name of the commit's author:

git show -s --format="%aN" $BITBUCKET_COMMIT

You can store the value in a variable during your build as follows:

Author=$(git show -s --format="%aN" $BITBUCKET_COMMIT)

Kind regards,
Theodora

Deleted user February 6, 2022

This really helped. Thank you so much!!!

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 7, 2022

That's good to hear, you are very welcome!

Please feel free to reach out if you ever need anything else!

Kind regards,
Theodora

Like Deleted user likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events