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?
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
This really helped. Thank you so much!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's good to hear, you are very welcome!
Please feel free to reach out if you ever need anything else!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.