Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created September 30, 2015 08:04
Show Gist options
  • Save jechlin/6cde257fb6ec48007dc2 to your computer and use it in GitHub Desktop.
Save jechlin/6cde257fb6ec48007dc2 to your computer and use it in GitHub Desktop.
import com.atlassian.stash.event.pull.PullRequestMergeActivityEvent
import com.atlassian.stash.pull.PullRequestAction
def event = event as PullRequestMergeActivityEvent
if (event.action != PullRequestAction.MERGED) {
// not a merge, we don't care about this event so return false
return false
}
def fromRef = event.pullRequest.fromRef // branch ref that is the pull request source branch
// pull request source branch is one we care about?
def branchesMatch = fromRef.id.startsWith("refs/heads/ZuoraPanda3") || fromRef.id.startsWith("refs/heads/release/")
// does the PR make changes to paths we care about?
def pathsMatch = event.pullRequest.pathsMatch('glob:build/template/') || event.pullRequest.pathsMatch('glob:build/deploytypes/')
// condition returns true if both source branch is interesting, and paths is interesting
return branchesMatch && pathsMatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment