It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Post-hooks Unsuccessfully Triggered After Clicking Merge Button in a Pull Request

Ted Sheibar Jan 28, 2013

If a developer makes a direct push to a branch using a repository's Stash URL, the post-receive hook gets successfully triggered.

However, the same hook doesn't trigger if the developer uses the Merge button after his/her changes are code reviewed.

I thought that since the pull request merge happens server-side, the post-commit hook would be the correct place to have a repository trigger. However, having the repo trigger in both the post-receive and post-commit still didn't work after using the Merge button in a pull request.

Is this a bug? What hooks are called before and after the server-side merge in Stash?

4 answers

1 accepted

4 votes
Answer accepted
Josh Baird Jan 06, 2014

Is it still not possible to have a hook that is triggered after a pull request merge?

1 vote
Tim Pettersen Jan 29, 2013

Hi rl_ted,

The mechanism that performs the pull request merge is actually based on a git fetch into the repository, which doesn't trigger receive hooks. Unfortunately there are currently no hooks that will be invoked automatically after a merge.

That said, if you want to trigger functionality based on a pull request merge, you can build a Stash plugin that consumes the PullRequestMergedEvent. There is also a java API for implementing commit-hooks in a plugin. If you're unfamiliar with Atlassian plugins, the Atlassian SDK is a good place to start.

I'd also keep an eye on STASH-2521, which tracks improved commit hooks support in Stash and should hit arelease in the near future.



Ted Sheibar Feb 02, 2013

Thank you, Tim.

0 votes
Daniel Rohan Atlassian Team Jul 18, 2014

The improvement request that Tim originally provided has been split-up. Follow this improvement request instead: -

0 votes
Tim Pettersen Jul 18, 2014

Hi guys,

Here's an update on my answer from last year:

Repository hooks implementing AsyncPostReceiveRepositoryHook will be called for both pushes and Pull Request merges. See for full details.



Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

167 views 21 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you