Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Commit ab5e796

Browse files
daveneeleytomasbjerre
authored andcommitted
Update Azure Pipelines Sample to set branch of pull request (#327)
* Trigger builds on branches * triggerInfo is returned by later api calls, properties are not
1 parent f6836b0 commit ab5e796

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README_azurepiplines.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,22 @@ Here is how to integrate with Azure Pipelines (VSTS).
1010
"definition": {
1111
"id": <build definitionId from url>
1212
}
13+
"reason": "pullRequest",
14+
"sourceBranch": "${PULL_REQUEST_FROM_ID}",
15+
"sourceVersion": "${PULL_REQUEST_FROM_HASH}",
16+
"triggerInfo": {
17+
"url": "${PULL_REQUEST_URL}",
18+
"user": "${PULL_REQUEST_USER_EMAIL_ADDRESS}",
19+
"title": "${PULL_REQUEST_TITLE}",
20+
"version": "${PULL_REQUEST_VERSION}",
21+
"author": "${PULL_REQUEST_AUTHOR_EMAIL}",
22+
"reviewers": "${PULL_REQUEST_REVIEWERS_EMAIL}"
23+
}
1324
}
1425
```
1526
* Encode post content as JSON
1627
* In **Headers** add "Content-Type" with value "application/json"
1728

18-
Additional data can be sent in the post. See [Azure API Docs](https://docs.microsoft.com/en-us/rest/api/azure/devops/build/Builds/Queue?view=azure-devops-rest-5.0) for more info. The build history will state 'Manual build for <owner of personal access token>' for each build triggered by this method.
29+
Additional data can be sent in the post. See [Azure API Docs](https://docs.microsoft.com/en-us/rest/api/azure/devops/build/Builds/Queue?view=azure-devops-rest-5.0) for more info. The triggerInfo collection is not shown in the VSTS UI, but is returned in API calls.
30+
31+
It's a good idea to use a personal access token from a service principal for authentication. The queued builds will all state that they were triggered by the owner of the token.

0 commit comments

Comments
 (0)