Pull Request Merge Event - Tags


When I accept pull request, tags from fork are not copy to upstream. It’s normal behavior, but I really want this tags. So, I have a few questions:

  1. How I can run code when I accept pull request?
  2. How I can pass information about this two repositories to above event?

I found example, how get information about tags, so I need only this answers to complete my plugin (probably).

Try to use PullRequestMergedEvent.
Responding to application events documentation

Thank you for reply, but I have problem with this tutorial.

package com.example.tutorial;

import javax.inject.Named;

import com.atlassian.bitbucket.event.repository.RepositoryPullEvent;
import com.atlassian.event.api.EventListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestListener {

    private static final Logger log = LoggerFactory.getLogger(TestListener.class);

    //Whenever a push is made, the RepositoryPushEvent is fired and this listener is called
    public void onPushEvent(RepositoryPullEvent pushEvent) {
        log.debug("A push was made to {}", pushEvent.getRepository());

This code doesn’t work, because when I use command “git fetch” or “git pull”, I don’t see any new logs in terminal. Breakpoint on “log.debug([…])” doesn’t work too. I tried RepositoryPushEvent, but doesn’t work too…

To enable debug logging, go to the Bitbucket Server administration area, choose Logging and Profiling (under ‘Support’) and select Enable debug logging .
Learn more

After select this option I still not see my logs…

My code:

package com.example.prl;

import javax.inject.Named;

import com.atlassian.bitbucket.event.repository.RepositoryPullEvent;
import com.atlassian.bitbucket.event.repository.RepositoryPushEvent;
import com.atlassian.event.api.EventListener;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class myPrl {
    public static final Logger log = LoggerFactory.getLogger(myPrl.class);

    public myPrl(){
        System.out.println("CLASS CREATED TEST @@@@");

    public void myListener(RepositoryPullEvent event){
        log.info("PULL EVENT TRIGGERED @@@@");
        System.out.println("PULL EVENT TRIGGERED @@@@");

    public void myListener(RepositoryPushEvent event){
        log.info("PUSH EVENT TRIGGERED @@@@");
        System.out.println("PUSH EVENT TRIGGERED @@@@");

Finally, It works! Thank you @yorlov for your help!
I do two things:

  1. Add logging.logger.{packageName}=INFO (in my case, logging.logger.com.example.prl=INFO ) line to {projectFolder}/target/bitbucket/home/shared/bitbucket.properties
  2. Add packages to <Import-Package> in pom.xml file (in my case, above code):