zarplata/concourse-git-bitbucket-pr-resource

source.branch

myles-mcdonnell opened this issue · 3 comments

I need to trigger a job when a PR is raised against a branch. For example say I create a feature branch feat/xxx and I raise a PR from feat/xxx to master I need this job to run because a PR targeted master.

What I have observed is that the source.branch works the other way around, so if I set source.branch: feat/xxx it would trigger whenever I create a PR from feat/xxx regardless of the target branch.

This seems backwards to my way of thinking, is this by design or a mistake? Is there a way to achieve the behaviour I want via configuration?

ah, the source.direction parameter was staring me in the face...doh!

..spoke too soon, setting source.direction to incoming along with the branch set to the destination branch appears to be horribly broken:

  • fires on every PR
  • tries to pull the source branch commit hash from the destination branch, which of course does not exist

Ok so I have hacked up a fix for my use case here:

myles-mcdonnell@aca16f3

If/when I have time I may make this play nicely with everything else and raise a PR but in all honestly given my workload that probably isn't gonna happen. I know, I know...I'm a bad person :/