Enriching the data available in my Azure DevOps Pipelines Cross Platform Release Notes Task
A common request for my Generate Release Notes Tasks is to enrich the data available beyond basic build, work item and commit/changeset details. I have resisted these requests as it felt like a never ending journey to start. However, I have now relented and added the option to see any pull request information available.
This feature is limited, you obviously have to be using artifacts that linked to a Git repo, and also the Git repo have to on an Azure DevOps hosted repository. This won’t meet everyone’s needs but it is a start.
What was already available
Turns out there was already a means to get a limited set of PR details from a build. You used the form
1\*\*Build Trigger PR Number\*\*: ${buildDetails.triggerInfo\['pr.number'\]}
or in handlebars format
1\*\*Build Trigger PR Number\*\*: {{lookup buildDetails.triggerInfo 'pr.number'}}
The improvements
That said I have improved the options. There is now a new `prDetails` object available to the template.
If you use the dump option
1${JSON.stringify(prDetails)}
You can see the fields available
1{
2 "repository": {
3 "id": "bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59",
4 "name": "VSTSBuildTaskValidation",
5 "url": "[https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/\_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59"](https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59"),
6 "project": {
7 "id": "670b3a60-2021-47ab-a88b-d76ebd888a2f",
8 "name": "GitHub",
9 "description": "A container for GitHub CI/CD processes",
10 "url": "[https://richardfennell.visualstudio.com/\_apis/projects/670b3a60-2021-47ab-a88b-d76ebd888a2f"](https://richardfennell.visualstudio.com/_apis/projects/670b3a60-2021-47ab-a88b-d76ebd888a2f"),
11 "state": "wellFormed",
12 "revision": 411511726,
13 "visibility": 2,
14 "lastUpdateTime": "2019-10-10T20:35:51.85Z"
15 },
16 "size": 9373557,
17 "remoteUrl": "[https://richardfennell.visualstudio.com/DefaultCollection/GitHub/\_git/VSTSBuildTaskValidation"](https://richardfennell.visualstudio.com/DefaultCollection/GitHub/_git/VSTSBuildTaskValidation"),
18 "sshUrl": "richardfennell@vs-ssh.visualstudio.com:v3/richardfennell/GitHub/VSTSBuildTaskValidation",
19 "webUrl": "[https://richardfennell.visualstudio.com/DefaultCollection/GitHub/\_git/VSTSBuildTaskValidation"](https://richardfennell.visualstudio.com/DefaultCollection/GitHub/_git/VSTSBuildTaskValidation")
20 },
21 "pullRequestId": 4,
22 "codeReviewId": 4,
23 "status": 1,
24 "createdBy": {
25 "displayName": "Richard Fennell (Work MSA)",
26 "url": "[https://spsprodeus24.vssps.visualstudio.com/Ac0efb61e-a937-42a0-9658-649757d55d46/\_apis/Identities/b1fce0e9-fbf4-4202-bc09-a290def3e98b"](https://spsprodeus24.vssps.visualstudio.com/Ac0efb61e-a937-42a0-9658-649757d55d46/_apis/Identities/b1fce0e9-fbf4-4202-bc09-a290def3e98b"),
27 "\_links": {
28 "avatar": {
29 "href": "[https://richardfennell.visualstudio.com/\_apis/GraphProfile/MemberAvatars/aad.NzQzY2UyODUtN2Q0Ny03YjNkLTk0ZGUtN2Q0YjA1ZGE5NDdj"](https://richardfennell.visualstudio.com/_apis/GraphProfile/MemberAvatars/aad.NzQzY2UyODUtN2Q0Ny03YjNkLTk0ZGUtN2Q0YjA1ZGE5NDdj")
30 }
31 },
32 "id": "b1fce0e9-fbf4-4202-bc09-a290def3e98b",
33 "uniqueName": "bm-richard.fennell@outlook.com",
34 "imageUrl": "[https://richardfennell.visualstudio.com/\_api/\_common/identityImage?id=b1fce0e9-fbf4-4202-bc09-a290def3e98b"](https://richardfennell.visualstudio.com/_api/_common/identityImage?id=b1fce0e9-fbf4-4202-bc09-a290def3e98b"),
35 "descriptor": "aad.NzQzY2UyODUtN2Q0Ny03YjNkLTk0ZGUtN2Q0YjA1ZGE5NDdj"
36 },
37 "creationDate": "2020-04-04T10:44:59.566Z",
38 "title": "Added test.txt",
39 "description": "Added test.txt",
40 "sourceRefName": "refs/heads/branch2",
41 "targetRefName": "refs/heads/master",
42 "mergeStatus": 3,
43 "isDraft": false,
44 "mergeId": "f76a6556-8b4f-44eb-945a-9350124f067b",
45 "lastMergeSourceCommit": {
46 "commitId": "f43fa4de163c3ee0b4f17b72a659eac0d307deb8",
47 "url": "[https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/\_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/commits/f43fa4de163c3ee0b4f17b72a659eac0d307deb8"](https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/commits/f43fa4de163c3ee0b4f17b72a659eac0d307deb8")
48 },
49 "lastMergeTargetCommit": {
50 "commitId": "829ab2326201c7a5d439771eef5a57f58f94897d",
51 "url": "[https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/\_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/commits/829ab2326201c7a5d439771eef5a57f58f94897d"](https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/commits/829ab2326201c7a5d439771eef5a57f58f94897d")
52 },
53 "lastMergeCommit": {
54 "commitId": "53f393cae4ee3b901bb69858c4ee86cc8b466d6f",
55 "author": {
56 "name": "Richard Fennell (Work MSA)",
57 "email": "bm-richard.fennell@outlook.com",
58 "date": "2020-04-04T10:44:59.000Z"
59 },
60 "committer": {
61 "name": "Richard Fennell (Work MSA)",
62 "email": "bm-richard.fennell@outlook.com",
63 "date": "2020-04-04T10:44:59.000Z"
64 },
65 "comment": "Merge pull request 4 from branch2 into master",
66 "url": "[https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/\_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/commits/53f393cae4ee3b901bb69858c4ee86cc8b466d6f"](https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/commits/53f393cae4ee3b901bb69858c4ee86cc8b466d6f")
67 },
68 "reviewers": \[\],
69 "url": "[https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/\_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/pullRequests/4"](https://richardfennell.visualstudio.com/670b3a60-2021-47ab-a88b-d76ebd888a2f/_apis/git/repositories/bebd0ae2-405d-4c0a-b9c5-36ea94c1bf59/pullRequests/4"),
70 "supportsIterations": true,
71 "artifactId": "vstfs:///Git/PullRequestId/670b3a60-2021-47ab-a88b-d76ebd888a2f%2fbebd0ae2-405d-4c0a-b9c5-36ea94c1bf59%2f4"
72}
73
74```In templates this new object could be is used
**PR Title **: ${prDetails.title}
1or in handlebars format.
**PR Details**: {{prDetails.title}}
1
2It will be interesting to here feedback from the real world as opposed to test harnesses