@@ -12,23 +12,27 @@ export function detect(envs: ProviderEnvs): boolean {
1212 return Boolean ( envs ?. SYSTEM_TEAMFOUNDATIONSERVERURI ) ;
1313}
1414
15- function _getBuild ( inputs : ProviderUtilInputs ) : string {
15+ function _getBuild ( inputs : ProviderUtilInputs ) : ProviderServiceParams [ "build" ] {
1616 const { args, envs } = inputs ;
1717 if ( args ?. build && args . build !== "" ) {
1818 return args . build ;
1919 }
20- return envs ?. BUILD_BUILDNUMBER ?? "" ;
20+ return envs ?. BUILD_BUILDNUMBER ?? null ;
2121}
2222
23- function _getBuildURL ( inputs : ProviderUtilInputs ) : string {
23+ function _getBuildURL (
24+ inputs : ProviderUtilInputs ,
25+ ) : ProviderServiceParams [ "buildURL" ] {
2426 const { envs } = inputs ;
2527 if ( envs ?. SYSTEM_TEAMPROJECT && envs ?. BUILD_BUILDID ) {
2628 return `${ envs ?. SYSTEM_TEAMFOUNDATIONSERVERURI } ${ envs ?. SYSTEM_TEAMPROJECT } /_build/results?buildId=${ envs ?. BUILD_BUILDID } ` ;
2729 }
28- return "" ;
30+ return null ;
2931}
3032
31- function _getBranch ( inputs : ProviderUtilInputs ) : string {
33+ function _getBranch (
34+ inputs : ProviderUtilInputs ,
35+ ) : ProviderServiceParams [ "branch" ] {
3236 const { args, envs } = inputs ;
3337 if ( args ?. branch && args . branch !== "" ) {
3438 return args . branch ;
@@ -38,35 +42,38 @@ function _getBranch(inputs: ProviderUtilInputs): string {
3842 return envs ?. BUILD_SOURCEBRANCH . toString ( ) . replace ( "refs/heads/" , "" ) ;
3943 }
4044
41- return "" ;
45+ return null ;
4246}
4347
44- function _getJob ( envs : ProviderEnvs ) : string {
45- return envs ?. BUILD_BUILDID ?? "" ;
48+ function _getJob ( envs : ProviderEnvs ) : ProviderServiceParams [ "job" ] {
49+ return envs ?. BUILD_BUILDID ?? null ;
4650}
4751
48- function _getPR ( inputs : ProviderUtilInputs ) : string {
52+ function _getPR ( inputs : ProviderUtilInputs ) : ProviderServiceParams [ "pr" ] {
4953 const { args, envs } = inputs ;
5054 if ( args ?. pr && args . pr !== "" ) {
5155 return args . pr ;
5256 }
5357
54- const pr =
58+ return (
5559 envs ?. SYSTEM_PULLREQUEST_PULLREQUESTNUMBER ??
5660 envs ?. SYSTEM_PULLREQUEST_PULLREQUESTID ??
57- "" ;
58- return pr ;
61+ null
62+ ) ;
5963}
6064
61- function _getService ( ) : string {
65+ function _getService ( ) : ProviderServiceParams [ "service" ] {
6266 return "azure_pipelines" ;
6367}
6468
6569export function getServiceName ( ) : string {
6670 return "Azure Pipelines" ;
6771}
6872
69- function _getSHA ( inputs : ProviderUtilInputs , output : Output ) : string {
73+ function _getSHA (
74+ inputs : ProviderUtilInputs ,
75+ output : Output ,
76+ ) : ProviderServiceParams [ "commit" ] {
7077 const { args, envs } = inputs ;
7178 if ( args ?. sha && args . sha !== "" ) {
7279 debug ( `Using commit: ${ args ?. sha } ` , {
@@ -75,7 +82,7 @@ function _getSHA(inputs: ProviderUtilInputs, output: Output): string {
7582 return args . sha ;
7683 }
7784
78- let commit = envs ?. BUILD_SOURCEVERSION ?? "" ;
85+ let commit = envs ?. BUILD_SOURCEVERSION ?? null ;
7986
8087 if ( _getPR ( inputs ) ) {
8188 const mergeCommitRegex = / ^ [ a - z 0 - 9 ] { 40 } [ a - z 0 - 9 ] { 40 } $ / ;
@@ -105,13 +112,13 @@ function _getSHA(inputs: ProviderUtilInputs, output: Output): string {
105112 return commit ;
106113}
107114
108- function _getSlug ( inputs : ProviderUtilInputs ) : string {
115+ function _getSlug ( inputs : ProviderUtilInputs ) : ProviderServiceParams [ "slug" ] {
109116 const { args, envs } = inputs ;
110117 if ( args ?. slug && args . slug !== "" ) {
111118 return args . slug ;
112119 }
113120
114- return envs ?. BUILD_REPOSITORY_NAME ?? parseSlugFromRemoteAddr ( "" ) ?? "" ;
121+ return envs ?. BUILD_REPOSITORY_NAME ?? parseSlugFromRemoteAddr ( "" ) ?? null ;
115122}
116123
117124// eslint-disable-next-line @typescript-eslint/require-await
@@ -131,7 +138,7 @@ export async function getServiceParams(
131138 } ;
132139}
133140
134- export function getEnvVarNames ( ) : string [ ] {
141+ export function getEnvVarNames ( ) {
135142 return [
136143 "BUILD_BUILDID" ,
137144 "BUILD_BUILDNUMBER" ,
0 commit comments