Forums

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

Hook on pull request creation

Adam Kaufman
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!
December 12, 2014

The question:

Is it possible to create an arbitrary action that executes when a pull request gets created?

The use case:

I would like to create a Jenkins job, based on a standard set of rules, each time a pull request is created in a Stash repository.  I can use Jenkins polling to watch the branch from there and keep building on commits.  Also, I can use a merge request check plugin to approve or deny the merge based on the Jenkins build status.  Finally, I can clean up leftover jobs from merged pull requests using some yet-to-be-determined process.

The easiest way to implement this would probably be to write a third service that uses APIs of both applications to handle this asynchronously (with the notable exception of the merge request check).  I would like to avoid creating a separate entity, and so I am left with the question above.

If I'm barking up the wrong tree and someone has a suggestion for a better implementation, I'm all ears.  I'm still in the early stages here and haven't committed to any particular method.

Thanks

-adam

1 answer

1 accepted

3 votes
Answer accepted
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2014

You need to write a plugin that listens to the PullRequestOpenedEvent. For the Jenkins part, you can use the Jenkins webhook for inspiration.

Adam Kaufman
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!
December 12, 2014

Thanks for the quick response! Is there a concise list of events that can be listened for that I missed somewhere in the documentation?

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2014
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2014

(At the top at direct/indirect subclasses/)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events