Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the user that is merging the PR in a custom merge check?

Dan Greene August 7, 2025

We've built a custom merge check that needs to know who the user that is clicking the 'merge' button on the PR is.  There is no principal object in the context, and nothing that we can see in the event or context provides any clear guidance on who is attempting to merge the PR.  Any guidance would be appreciated!

 

Dan

2 comments

Comment

Log in or Sign up to comment
Dan Greene August 7, 2025

Just following up a bit on my own here - I do see the event.contextToken jwt - and it contains the accountId - but since a bitbucket app cannot connect to jira routes - it makes it hard to figure out who this person is still.  Any suggestions in getting a user from the accountId value in a bitbucket custom merge check?

Dan Greene August 7, 2025

fun - following up on my follow up--- finally got a call via the requestBitbucket thing - the accountId is the id of the app itself - NOT the person attempting to merge the PR... 

 

any pointers?

John Alberts
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!
August 8, 2025

When I first started using BB Pipelines, this is the very first thing I noticed and there is nothing directly available in the API that will give you this information.  It's a horrible missing feature.

What I ended up doing was collecting the info into an artifact in the PR build and saving that artifact in S3 using a naming convention that included the PR number.

Then in the build that runs on the destination branch, look at the first commit message on the destination branch.  It will included the PR number in the merge commit and you can use that to determine which artifact to pull down.

Hope this helps.

Dan Greene August 8, 2025

unfortunately - I think there's no way to get it - what we're going to have to do is change our business logic from the person merging the PR to instead looking at the approvers and rework our business needs around that. (do this if "x" person merged -> do this if "x" person approved it on merge) - bleh.

TAGS
AUG Leaders

Atlassian Community Events