@@ -12,23 +12,27 @@ export function detect(envs: ProviderEnvs): boolean {
12
12
return Boolean ( envs ?. SYSTEM_TEAMFOUNDATIONSERVERURI ) ;
13
13
}
14
14
15
- function _getBuild ( inputs : ProviderUtilInputs ) : string {
15
+ function _getBuild ( inputs : ProviderUtilInputs ) : ProviderServiceParams [ "build" ] {
16
16
const { args, envs } = inputs ;
17
17
if ( args ?. build && args . build !== "" ) {
18
18
return args . build ;
19
19
}
20
- return envs ?. BUILD_BUILDNUMBER ?? "" ;
20
+ return envs ?. BUILD_BUILDNUMBER ?? null ;
21
21
}
22
22
23
- function _getBuildURL ( inputs : ProviderUtilInputs ) : string {
23
+ function _getBuildURL (
24
+ inputs : ProviderUtilInputs ,
25
+ ) : ProviderServiceParams [ "buildURL" ] {
24
26
const { envs } = inputs ;
25
27
if ( envs ?. SYSTEM_TEAMPROJECT && envs ?. BUILD_BUILDID ) {
26
28
return `${ envs ?. SYSTEM_TEAMFOUNDATIONSERVERURI } ${ envs ?. SYSTEM_TEAMPROJECT } /_build/results?buildId=${ envs ?. BUILD_BUILDID } ` ;
27
29
}
28
- return "" ;
30
+ return null ;
29
31
}
30
32
31
- function _getBranch ( inputs : ProviderUtilInputs ) : string {
33
+ function _getBranch (
34
+ inputs : ProviderUtilInputs ,
35
+ ) : ProviderServiceParams [ "branch" ] {
32
36
const { args, envs } = inputs ;
33
37
if ( args ?. branch && args . branch !== "" ) {
34
38
return args . branch ;
@@ -38,35 +42,38 @@ function _getBranch(inputs: ProviderUtilInputs): string {
38
42
return envs ?. BUILD_SOURCEBRANCH . toString ( ) . replace ( "refs/heads/" , "" ) ;
39
43
}
40
44
41
- return "" ;
45
+ return null ;
42
46
}
43
47
44
- function _getJob ( envs : ProviderEnvs ) : string {
45
- return envs ?. BUILD_BUILDID ?? "" ;
48
+ function _getJob ( envs : ProviderEnvs ) : ProviderServiceParams [ "job" ] {
49
+ return envs ?. BUILD_BUILDID ?? null ;
46
50
}
47
51
48
- function _getPR ( inputs : ProviderUtilInputs ) : string {
52
+ function _getPR ( inputs : ProviderUtilInputs ) : ProviderServiceParams [ "pr" ] {
49
53
const { args, envs } = inputs ;
50
54
if ( args ?. pr && args . pr !== "" ) {
51
55
return args . pr ;
52
56
}
53
57
54
- const pr =
58
+ return (
55
59
envs ?. SYSTEM_PULLREQUEST_PULLREQUESTNUMBER ??
56
60
envs ?. SYSTEM_PULLREQUEST_PULLREQUESTID ??
57
- "" ;
58
- return pr ;
61
+ null
62
+ ) ;
59
63
}
60
64
61
- function _getService ( ) : string {
65
+ function _getService ( ) : ProviderServiceParams [ "service" ] {
62
66
return "azure_pipelines" ;
63
67
}
64
68
65
69
export function getServiceName ( ) : string {
66
70
return "Azure Pipelines" ;
67
71
}
68
72
69
- function _getSHA ( inputs : ProviderUtilInputs , output : Output ) : string {
73
+ function _getSHA (
74
+ inputs : ProviderUtilInputs ,
75
+ output : Output ,
76
+ ) : ProviderServiceParams [ "commit" ] {
70
77
const { args, envs } = inputs ;
71
78
if ( args ?. sha && args . sha !== "" ) {
72
79
debug ( `Using commit: ${ args ?. sha } ` , {
@@ -75,7 +82,7 @@ function _getSHA(inputs: ProviderUtilInputs, output: Output): string {
75
82
return args . sha ;
76
83
}
77
84
78
- let commit = envs ?. BUILD_SOURCEVERSION ?? "" ;
85
+ let commit = envs ?. BUILD_SOURCEVERSION ?? null ;
79
86
80
87
if ( _getPR ( inputs ) ) {
81
88
const mergeCommitRegex = / ^ [ a - z 0 - 9 ] { 40 } [ a - z 0 - 9 ] { 40 } $ / ;
@@ -105,13 +112,13 @@ function _getSHA(inputs: ProviderUtilInputs, output: Output): string {
105
112
return commit ;
106
113
}
107
114
108
- function _getSlug ( inputs : ProviderUtilInputs ) : string {
115
+ function _getSlug ( inputs : ProviderUtilInputs ) : ProviderServiceParams [ "slug" ] {
109
116
const { args, envs } = inputs ;
110
117
if ( args ?. slug && args . slug !== "" ) {
111
118
return args . slug ;
112
119
}
113
120
114
- return envs ?. BUILD_REPOSITORY_NAME ?? parseSlugFromRemoteAddr ( "" ) ?? "" ;
121
+ return envs ?. BUILD_REPOSITORY_NAME ?? parseSlugFromRemoteAddr ( "" ) ?? null ;
115
122
}
116
123
117
124
// eslint-disable-next-line @typescript-eslint/require-await
@@ -131,7 +138,7 @@ export async function getServiceParams(
131
138
} ;
132
139
}
133
140
134
- export function getEnvVarNames ( ) : string [ ] {
141
+ export function getEnvVarNames ( ) {
135
142
return [
136
143
"BUILD_BUILDID" ,
137
144
"BUILD_BUILDNUMBER" ,
0 commit comments