This script automatically check the Delete source branch after merging checkbox present on the pull request merge dialog. Automatic checking of the checkbox may be useful for teams that want to enforce that branches are deleted once they have been merged into other branches.

This script can optionally be configured to only check the checkbox if the source branch name of the pull request matches a specific pattern. A list of regular expressions can be provided in the Branch Naming Patterns field, the checkbox will only be checked for source branches with a name that matches one or more of these expressions.

For example, if you only wanted the checkbox to be checked for source branch names that begin with the text feature/ you could configure the following expression: