6

How do you get VSTS to build when a PR is created in GitHub? I've tried several triggers in the VSTS build like refs/pull/*/merge and refs/pull/*/head. I have a build working when a commit is made to the master branch, but I can't get a build to trigger when a PR is created.

I get the following when a PR is created. enter image description here

Also, the webhook history shows that a message was successfully posted to VSTS, but the build never starts.

viperguynaz
  • 12,044
  • 4
  • 30
  • 41

4 Answers4

1

I think it's the trigger. Try what's described in this blog post.

Buck Hodges
  • 3,342
  • 1
  • 19
  • 20
  • 1
    When I looked into this a number of months ago it appears the integration set up by VSTS only subscribes to the `Push` event that doesn't appear to be triggered by a PR being created. Modifying the webhook won't be enough since the payload is different. – Nigel Sampson Jan 04 '17 at 03:18
1

The official Microsoft VSTS GitHub Integration extension now supports this directly.

Lukas Spieß
  • 2,478
  • 2
  • 19
  • 24
  • Can the extensions be configured to work with GitHub Enterprise? – Eric Dobbs Oct 25 '17 at 20:20
  • As far as I know it doesn't yet, reading the extension's description also doesn't sound like it: https://marketplace.visualstudio.com/items?itemName=ms-vsts.services-github#overview – Lukas Spieß Oct 27 '17 at 19:56
0

There is not an easy way to enable this today for PRs. It is on the VSTS feature backlog that we want to address soon.

The way to make it work today would be to do something like: add a webhook to call your own custom service endpoint. Within your service endpoint, you could then call into VSTS to queue a build, and the build would need a step to post success/fail back to GitHub.

In your custom service endpoint, you would need to make sure the user is authorized as a contributor on the GitHub repo.

0

On the new VSTS UI you can find it in Build Edit -> Triggers:

Jacob
  • 627
  • 6
  • 15