Repository navigation
Expand file tree
/
Copy pathbuild.ts
More file actions
59 lines (55 loc) · 1.72 KB
/
Copy pathbuild.ts
File metadata and controls
59 lines (55 loc) · 1.72 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import {BuildStatus, FastlaneStatus, fastlaneStatusToEnum} from '../common/constants';
const SHORT_SHA_LENGTH = 6;
export interface BuildResponse {
number: number;
project_id: string;
status: FastlaneStatus;
duration: number;
description: string;
trigger: string;
lane: string;
platform: string;
parameters: {[param: string]: string};
build_tools: {[tool: string]: string};
clone_url: string;
branch: string;
ref: string;
sha: string;
timestamp: string;
}
export class Build {
readonly number: number;
readonly projectId: string;
readonly status: FastlaneStatus;
readonly duration: number;
readonly description: string;
readonly trigger: string;
readonly lane: string;
readonly platform: string;
readonly parameters: {[param: string]: string};
readonly buildTools: {[tool: string]: string};
readonly cloneUrl: string;
readonly branch: string;
readonly ref: string;
readonly sha: string;
readonly shortSha: string;
readonly date: Date;
constructor(buildSummary: BuildResponse) {
this.number = buildSummary.number;
this.projectId = buildSummary.project_id;
this.description = buildSummary.description;
this.trigger = buildSummary.trigger;
this.lane = buildSummary.lane;
this.platform = buildSummary.platform;
this.parameters = buildSummary.parameters;
this.buildTools = buildSummary.build_tools;
this.cloneUrl = buildSummary.clone_url;
this.branch = buildSummary.branch;
this.ref = buildSummary.ref;
this.duration = buildSummary.duration;
this.sha = buildSummary.sha;
this.shortSha = this.sha.slice(0, SHORT_SHA_LENGTH);
this.status = fastlaneStatusToEnum(buildSummary.status);
this.date = new Date(buildSummary.timestamp);
}
}