-
Notifications
You must be signed in to change notification settings - Fork 231
/
release.ts
42 lines (35 loc) · 1.87 KB
/
release.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as common from './common';
import * as nodeApi from 'azure-devops-node-api';
import * as ReleaseApi from 'azure-devops-node-api/ReleaseApi';
import * as ReleaseInterfaces from 'azure-devops-node-api/interfaces/ReleaseInterfaces';
export async function run() {
const projectId: string = common.getProject();
const webApi: nodeApi.WebApi = await common.getWebApi();
const releaseApiObject: ReleaseApi.IReleaseApi = await webApi.getReleaseApi();
common.banner('Release Samples');
common.heading('Get releases');
const releases: ReleaseInterfaces.Release[] = await releaseApiObject.getReleases(projectId);
console.log('There are', releases.length, 'releases for this project');
if(releases.length > 0) {
const release = releases[0];
console.log('Info for release', release.name);
console.log('Logs for this release:', releaseApiObject.getLogs(projectId, release.id));
const workItemRefs: ReleaseInterfaces.ReleaseWorkItemRef[] = await releaseApiObject.getReleaseWorkItemsRefs(projectId, release.id);
console.log('There are', workItemRefs.length, 'work items associated with this release');
if (workItemRefs.length > 0) {
console.log('Example work item', workItemRefs[0]);
}
}
else {
console.log('Must have at least 1 release to do samples with releases');
}
common.heading('Get metadata');
console.log('Release settings:', await releaseApiObject.getReleaseSettings(projectId));
console.log('Tags:', await releaseApiObject.getTags(projectId));
common.heading('Get Approval information');
const approvals: ReleaseInterfaces.ReleaseApproval[] = await releaseApiObject.getApprovals(projectId);
console.log('There are', approvals.length, 'approvals for this project');
if (approvals.length > 0) {
console.log('Sample approval:', approvals[0]);
}
}