Listeners

ScriptRunner allows you to respond to Bitbucket events, via an inline script or pointer to a file. You can view the full list of events here.

You could respond to events, for example in order to:

  • ensure a Jira project exists for a corresponding Bitbucket project

  • send mail when a repository is forked

  • set up Continuous Integration for new repositories

Some events in Bitbucket are cancelable - you can cancel an event in order to prevent a user:

  • creating a project

  • a repository

  • forking a project

Find the list of cancelable events here.

Adding a Listener

Navigate to Admin → Script Listener. Click a heading to add a listener. Choose Custom Listener to use your own scripts to respond to events.

  1. Add a name for the listener in the Name field, which you can use as a reference.
  2. Select the Projects/repositories where the listener will be configured.
  3. Select the Events field, and begin typing to find the events you want to listen for. The event types are grouped into Cancelable and Non-cancelable categories.
    Some of the built-in content will have different options and may not ask for the events to listen for.
  4. Enter your script details as either Inline or from the File. You can enter code directly into the script editor. You also have the option to click Example Scripts and copy code from a selection of relevant script examples. 
  5. Click Add.
On this page