Repository: codecov/uploader
Pull request #375 (2021-09-20 14:42:56)

Always use CI detection


Patch:
diff --git a/bin/codecov.ts b/bin/codecov.ts
index 24320a9..bbb836d 100755
--- a/bin/codecov.ts
+++ b/bin/codecov.ts
@@ -1,33 +1,33 @@
 #!/usr/bin/env node
 
-import { logError, main, verbose } from '../src'
+import { logError, main, verbose} from '../src'
 import { addArguments } from '../src/helpers/cli'
 
 var argv = require('yargs') // eslint-disable-line
 
+
 argv.usage('Usage: $0 <command> [options]')
 
 addArguments(argv)
 
-argv.version().help('help').alias('help', 'h').argv
+  argv.version()
+  .help('help')
+  .alias('help', 'h').argv
 
-const realArgs = argv.argv
+  const realArgs = argv.argv
 
-const start = Date.now()
+  const start = Date.now()
 
 verbose(`Start of uploader: ${start}...`, Boolean(argv.verbose))
 main(realArgs)
   .then(() => {
     const end = Date.now()
-    verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose)
+    verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose,
+    )
   })
   .catch(error => {
-    if (error instanceof Error) {
-      logError(`There was an error running the uploader: ${error.message}`)
-      verbose(`The error stack is: ${error.stack}`, argv.verbose)
-    }
-
+    logError(error)
     const end = Date.now()
     verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose)
-    process.exit(realArgs.nonZero ? -1 : 0)
+    process.exit(Boolean(realArgs.nonZero) ? -1 : 0)
   })
diff --git a/src/ci_providers/provider_appveyorci.ts b/src/ci_providers/provider_appveyorci.ts
index 2b94009..4fbeea1 100644
--- a/src/ci_providers/provider_appveyorci.ts
+++ b/src/ci_providers/provider_appveyorci.ts
@@ -43,9 +43,9 @@ function _getJob(envs: UploaderEnvs) {
   return ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.APPVEYOR_PULL_REQUEST_NUMBER || '')
+  return args.pr || envs.APPVEYOR_PULL_REQUEST_NUMBER || ''
 }
 
 function _getService() {
diff --git a/src/ci_providers/provider_azurepipelines.ts b/src/ci_providers/provider_azurepipelines.ts
index 59e26de..97303d7 100644
--- a/src/ci_providers/provider_azurepipelines.ts
+++ b/src/ci_providers/provider_azurepipelines.ts
@@ -34,13 +34,13 @@ function _getJob(envs: UploaderEnvs): string {
   return envs.BUILD_BUILDID || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
   return (
-    Number(args.pr ||
+    args.pr ||
     envs.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER ||
     envs.SYSTEM_PULLREQUEST_PULLREQUESTID ||
-    '')
+    ''
   )
 }
 
diff --git a/src/ci_providers/provider_bitbucket.ts b/src/ci_providers/provider_bitbucket.ts
index 568747e..d6f3de0 100644
--- a/src/ci_providers/provider_bitbucket.ts
+++ b/src/ci_providers/provider_bitbucket.ts
@@ -27,9 +27,9 @@ function _getJob(envs: UploaderEnvs): string {
   return envs.BITBUCKET_BUILD_NUMBER || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.BITBUCKET_PR_ID || '')
+  return args.pr || envs.BITBUCKET_PR_ID || ''
 }
 
 function _getService(): string {
diff --git a/src/ci_providers/provider_buildkite.ts b/src/ci_providers/provider_buildkite.ts
index 23e9778..47eec6c 100644
--- a/src/ci_providers/provider_buildkite.ts
+++ b/src/ci_providers/provider_buildkite.ts
@@ -59,9 +59,9 @@ function _getJob(envs: UploaderEnvs): string {
  * @param {args: {}, envs: {}} inputs an object of arguments and enviromental variable key/value pairs
  * @returns {string}
  */
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args } = inputs
-  return Number(args.pr || '')
+  return args.pr || ''
 }
 
 /**
diff --git a/src/ci_providers/provider_circleci.ts b/src/ci_providers/provider_circleci.ts
index 6ca8eaf..2fb2928 100644
--- a/src/ci_providers/provider_circleci.ts
+++ b/src/ci_providers/provider_circleci.ts
@@ -54,9 +54,9 @@ function _getBuild(inputs: UploaderInputs): string {
   return args.build || envs.CIRCLE_BUILD_NUM || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.CIRCLE_PR_NUMBER || '')
+  return args.pr || envs.CIRCLE_PR_NUMBER || ''
 }
 
 function _getJob(envs: UploaderEnvs): string {
diff --git a/src/ci_providers/provider_cirrus.ts b/src/ci_providers/provider_cirrus.ts
index 7538a43..e5b7a89 100644
--- a/src/ci_providers/provider_cirrus.ts
+++ b/src/ci_providers/provider_cirrus.ts
@@ -23,9 +23,9 @@ function _getJob(envs: UploaderEnvs): string {
   return envs.CIRRUS_TASK_ID || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.CIRRUS_PR || '')
+  return args.pr || envs.CIRRUS_PR || ''
 }
 
 function _getService(): string {
diff --git a/src/ci_providers/provider_codebuild.ts b/src/ci_providers/provider_codebuild.ts
index e9c2131..95bd954 100644
--- a/src/ci_providers/provider_codebuild.ts
+++ b/src/ci_providers/provider_codebuild.ts
@@ -28,14 +28,14 @@ function _getJob(envs: UploaderEnvs): string {
   return envs.CODEBUILD_BUILD_ID || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
   return (
-    Number(args.pr ||
+    args.pr ||
     (envs.CODEBUILD_SOURCE_VERSION &&
     envs.CODEBUILD_SOURCE_VERSION.startsWith('pr/')
       ? envs.CODEBUILD_SOURCE_VERSION.replace(/^pr\//, '')
-      : '')
+      : ''
   ))
 }
 
diff --git a/src/ci_providers/provider_drone.ts b/src/ci_providers/provider_drone.ts
index 5f548ed..bcf9184 100644
--- a/src/ci_providers/provider_drone.ts
+++ b/src/ci_providers/provider_drone.ts
@@ -24,9 +24,9 @@ function _getJob(envs: UploaderEnvs): string {
   return ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.DRONE_PULL_REQUEST || '')
+  return args.pr || envs.DRONE_PULL_REQUEST || ''
 }
 
 function _getService(): string {
diff --git a/src/ci_providers/provider_githubactions.ts b/src/ci_providers/provider_githubactions.ts
index 776858e..b049769 100644
--- a/src/ci_providers/provider_githubactions.ts
+++ b/src/ci_providers/provider_githubactions.ts
@@ -40,7 +40,7 @@ function _getJob(envs: UploaderEnvs): string {
   return (envs.GITHUB_WORKFLOW || '')
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
   let match
   if (envs.GITHUB_HEAD_REF && envs.GITHUB_HEAD_REF !== '') {
@@ -50,7 +50,7 @@ function _getPR(inputs: UploaderInputs): number {
       match = matches[1]
     }
   }
-  return Number(args.pr || match || '')
+  return args.pr || match || ''
 }
 
 function _getService(): string {
@@ -66,7 +66,7 @@ function _getSHA(inputs: UploaderInputs): string {
   const pr = _getPR(inputs)
 
   let commit = envs.GITHUB_SHA
-  if (pr && pr !== 0 && !args.sha) {
+  if (pr && pr !== '' && !args.sha) {
     const mergeCommitRegex = /^[a-z0-9]{40} [a-z0-9]{40}$/
     const mergeCommitMessage = childProcess
       .spawnSync('git', ['show', '--no-patch', '--format="%P"'])
diff --git a/src/ci_providers/provider_gitlabci.ts b/src/ci_providers/provider_gitlabci.ts
index 89ccb75..9da0210 100644
--- a/src/ci_providers/provider_gitlabci.ts
+++ b/src/ci_providers/provider_gitlabci.ts
@@ -26,9 +26,9 @@ function _getJob(envs: UploaderEnvs): string {
   return ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args } = inputs
-  return Number(args.pr || '')
+  return args.pr || ''
 }
 
 function _getService(): string {
diff --git a/src/ci_providers/provider_jenkinsci.ts b/src/ci_providers/provider_jenkinsci.ts
index abee0cd..22000e5 100644
--- a/src/ci_providers/provider_jenkinsci.ts
+++ b/src/ci_providers/provider_jenkinsci.ts
@@ -31,9 +31,9 @@ function _getJob(envs: UploaderEnvs) {
   return ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.ghprbPullId || envs.CHANGE_ID || '')
+  return args.pr || envs.ghprbPullId || envs.CHANGE_ID || ''
 }
 
 function _getService(): string {
diff --git a/src/ci_providers/provider_local.ts b/src/ci_providers/provider_local.ts
index 72b8929..bfdf8ed 100644
--- a/src/ci_providers/provider_local.ts
+++ b/src/ci_providers/provider_local.ts
@@ -38,9 +38,9 @@ function _getJob(env: UploaderEnvs): string {
 }
 
 // eslint-disable-next-line no-unused-vars
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args } = inputs
-  return Number(args.pr || '')
+  return args.pr || ''
 }
 
 // This is the value that gets passed to the Codecov uploader
diff --git a/src/ci_providers/provider_teamcity.ts b/src/ci_providers/provider_teamcity.ts
index 96e628f..da22f9f 100644
--- a/src/ci_providers/provider_teamcity.ts
+++ b/src/ci_providers/provider_teamcity.ts
@@ -40,9 +40,9 @@ function _getBuild(inputs: UploaderInputs): string {
   return args.build || envs.BUILD_NUMBER || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args } = inputs
-  return Number(args.pr || '')
+  return args.pr || ''
 }
 
 // eslint-disable-next-line no-unused-vars
diff --git a/src/ci_providers/provider_travisci.ts b/src/ci_providers/provider_travisci.ts
index fe0fdf3..913de53 100644
--- a/src/ci_providers/provider_travisci.ts
+++ b/src/ci_providers/provider_travisci.ts
@@ -28,9 +28,9 @@ function _getJob(envs: UploaderEnvs): string {
   return envs.TRAVIS_JOB_ID || ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args, environment: envs } = inputs
-  return Number(args.pr || envs.TRAVIS_PULL_REQUEST || '')
+  return args.pr || envs.TRAVIS_PULL_REQUEST || ''
 }
 
 function _getService(): string {
diff --git a/src/ci_providers/provider_wercker.ts b/src/ci_providers/provider_wercker.ts
index c1363f9..ff0efdd 100644
--- a/src/ci_providers/provider_wercker.ts
+++ b/src/ci_providers/provider_wercker.ts
@@ -25,9 +25,9 @@ function _getJob(envs: UploaderEnvs): string {
   return ''
 }
 
-function _getPR(inputs: UploaderInputs): number {
+function _getPR(inputs: UploaderInputs): string {
   const { args } = inputs
-  return Number(args.pr || '')
+  return args.pr || ''
 }
 
 function _getService(): string {
diff --git a/src/helpers/provider.ts b/src/helpers/provider.ts
index 8684271..2cf40e7 100644
--- a/src/helpers/provider.ts
+++ b/src/helpers/provider.ts
@@ -2,32 +2,27 @@ import providers from '../ci_providers'
 import { info, logError, verbose } from '../helpers/logger'
 import { IServiceParams, UploaderInputs } from '../types'
 
-export function detectProvider(inputs: UploaderInputs): IServiceParams {
+export function detectProvider(inputs: UploaderInputs): Partial<IServiceParams> {
   const { args, environment } = inputs
-  let serviceParams: IServiceParams | undefined
+  let serviceParams: Partial<IServiceParams> | undefined
 
   //   check if we have a complete set of manual overrides (slug, SHA)
   if (args.sha && args.slug) {
     // We have the needed args for a manual override
     info(
-      `Using manual override from args. CI Provider detection will not be ran.`,
+      `Using manual override from args.`,
     )
     serviceParams = {
-      branch: '',
-      build: '',
-      buildURL: '',
       commit: args.sha,
-      job: '',
-      pr: 0,
-      service: '',
       slug: args.slug,
     }
-    return serviceParams
+  } else {
+    serviceParams = undefined
   }
 
-  //   if not, loop though all providers
+  //   loop though all providers
   try {
-    serviceParams = walkProviders(inputs)
+    serviceParams = { ...walkProviders(inputs), ...serviceParams }
     if (serviceParams !== undefined) {
       return serviceParams
     }
@@ -35,11 +30,13 @@ export function detectProvider(inputs: UploaderInputs): IServiceParams {
     //   if fails, display message explaining failure, and explaining that SHA and slug need to be set as args
     if (serviceParams !== undefined) {
       logError(`Errow detecting repos setting using git: ${error}`)
+    } else {
+      throw new Error(
+        '\nUnable to detect service, please specify sha and slug manually.\nYou can do this by passing the values with the `-S` and `-r` flags.\nSee the `-h` flag for more details.',
+      )
     }
   }
-  throw new Error(
-    '\nUnable to detect service, please specify sha and slug manually.\nYou can do this by passing the values with the `-S` and `-r` flags.\nSee the `-h` flag for more details.',
-  )
+  return serviceParams
 }
 
 export function walkProviders(
diff --git a/src/helpers/web.ts b/src/helpers/web.ts
index 8131991..5040e60 100644
--- a/src/helpers/web.ts
+++ b/src/helpers/web.ts
@@ -16,8 +16,8 @@ import { checkValueType } from './validate'
  */
 export function populateBuildParams(
   inputs: UploaderInputs,
-  serviceParams: IServiceParams,
-): IServiceParams {
+  serviceParams: Partial<IServiceParams>,
+): Partial<IServiceParams> {
   const { args, environment: envs } = inputs
   serviceParams.name = args.name || envs.CODECOV_NAME || ''
   serviceParams.tag = args.tag || ''
@@ -109,11 +109,7 @@ export async function uploadToCodecov(
  * @param {Object} queryParams
  * @returns {string}
  */
-export function generateQuery(queryParams: IServiceParams): string {
-  checkValueType('pr', queryParams.pr, 'number')
-  if (queryParams.pr === 0  || isNaN(Number(queryParams.pr))) {
-    queryParams.pr = ''
-  }
+export function generateQuery(queryParams: Partial<IServiceParams>): string {
   return new URLSearchParams(Object.entries(queryParams)
     .map(([key, value]) => [snakeCase(key), value])
   ).toString()
diff --git a/src/types.ts b/src/types.ts
index 0e0277f..b98b781 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -42,7 +42,7 @@ export interface IServiceParams {
   buildURL: string
   commit: string
   job: string
-  pr: number | ''
+  pr: string | ''
   service: string
   slug: string
   name?: string


Test patch:
diff --git a/test/helpers/provider.test.ts b/test/helpers/provider.test.ts
index f67d009..efb067f 100644
--- a/test/helpers/provider.test.ts
+++ b/test/helpers/provider.test.ts
@@ -17,21 +17,15 @@ describe('detectProvider()', () => {
       },
       environment: {},
     }
-    const expectedOutput: IServiceParams = {
-      branch: '',
-      build: '',
-      buildURL: '',
+    const expectedOutput: Partial<IServiceParams> = {
       commit: '1234566',
-      job: '',
-      pr: 0,
-      service: '',
       slug: 'fakeOrg/fakeRepo',
     }
-    expect(detectProvider(inputs)).toEqual(expectedOutput)
+    expect(detectProvider(inputs)).toMatchObject(expectedOutput)
   })
 
   it('will throw if unable to detect', () => {
-    jest.spyOn(console, 'error').mockImplementation(() => {})
+    jest.spyOn(console, 'error').mockImplementation(() => void {})
     const spawnSync = td.replace(childProcess, 'spawnSync')
     td.when(spawnSync('git')).thenReturn({
       error: 'Git is not installed!',
@@ -76,11 +70,10 @@ describe('walkProviders()', () => {
       buildURL: '',
       commit: '',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'circleci',
       slug: 'undefined/undefined',
     }
     expect(walkProviders(inputs)).toEqual(expectedOutput)
   })
 })
-
diff --git a/test/helpers/web.test.ts b/test/helpers/web.test.ts
index a3d1b26..08950cb 100644
--- a/test/helpers/web.test.ts
+++ b/test/helpers/web.test.ts
@@ -48,7 +48,7 @@ describe('Web Helpers', () => {
   })
 
   it('Can POST to the uploader endpoint (HTTPS)', async () => {
-    jest.spyOn(console, 'log').mockImplementation(() => {})
+    jest.spyOn(console, 'log').mockImplementation(() => void {})
     uploadURL = 'https://codecov.io'
     // deepcode ignore WrongNumberOfArgs/test: believe this is a false positive
     nock('https://codecov.io')
@@ -67,7 +67,7 @@ describe('Web Helpers', () => {
   })
 
   it('Can PUT to the storage endpoint', async () => {
-    jest.spyOn(console, 'log').mockImplementation(() => {})
+    jest.spyOn(console, 'log').mockImplementation(() => void {})
     uploadURL = `https://results.codecov.io
     https://codecov.io`
     const response = await uploadToCodecovPUT(uploadURL, uploadFile)
@@ -85,7 +85,7 @@ describe('Web Helpers', () => {
       slug: 'testOrg/testRepo',
       service: 'testingCI',
       flags: 'unit,uploader',
-      pr: 2,
+      pr: '2',
       job: '6',
     }
     expect(generateQuery(queryParams)).toBe(
@@ -93,7 +93,7 @@ describe('Web Helpers', () => {
     )
   })
 
-  it('NaN PR numbers are not propagated to the query', () => {
+  /* it('NaN PR numbers are not propagated to the query', () => {
     const queryParams: IServiceParams  = {
       branch: 'testBranch',
       commit: 'commitSHA',
@@ -110,7 +110,7 @@ describe('Web Helpers', () => {
     expect(generateQuery(queryParams)).toBe(
       'branch=testBranch&commit=commitSHA&build=4&build_url=https%3A%2F%2Fci-providor.local%2Fjob%2Fxyz&name=testName&tag=tagV1&slug=testOrg%2FtestRepo&service=testingCI&flags=unit%2Cuploader&pr=&job=6',
     )
-  })
+  }) */
 
   it('can populateBuildParams() from args', () => {
     const result = populateBuildParams(
@@ -126,7 +126,7 @@ describe('Web Helpers', () => {
         job: '',
         service: 'Testing',
         slug: '',
-        pr: 0,
+        pr: '0',
       },
     )
     expect(result.flags).toBe('testFlag')
@@ -146,7 +146,7 @@ describe('Web Helpers', () => {
         job: '',
         service: 'Testing',
         slug: '',
-        pr: 0,
+        pr: '0',
       },
     )
     expect(result.flags).toBe('testFlag1,testFlag2')
@@ -166,7 +166,7 @@ describe('Web Helpers', () => {
         job: '',
         service: 'Testing',
         slug: '',
-        pr: 0,
+        pr: '0',
       },
     )
     expect(result.flags).toBe('testFlag1,testFlag2')
diff --git a/test/providers/provider_appveyorci.test.ts b/test/providers/provider_appveyorci.test.ts
index e5fbb77..ff7b82e 100644
--- a/test/providers/provider_appveyorci.test.ts
+++ b/test/providers/provider_appveyorci.test.ts
@@ -83,7 +83,7 @@ describe('AppveyorCI Params', () => {
         'https://appveyor.com/project/testOrg/testRepo/builds/2/job/1',
       commit: 'testingsha',
       job: 'testOrg%2FtestRepo%2F3',
-      pr: 4,
+      pr: '4',
       service: 'appveyor',
       slug: 'testOrg/testRepo',
     }
@@ -112,7 +112,7 @@ describe('AppveyorCI Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'appveyor',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_azurepipelines.test.ts b/test/providers/provider_azurepipelines.test.ts
index 4f0ee2a..810dab9 100644
--- a/test/providers/provider_azurepipelines.test.ts
+++ b/test/providers/provider_azurepipelines.test.ts
@@ -67,7 +67,7 @@ describe('Jenkins CI Params', () => {
         'https://example.azure.comtestOrg/_build/results?buildId=2',
       commit: 'testingsha',
       job: '2',
-      pr: 3,
+      pr: '3',
       project: 'testOrg',
       server_uri: 'https://example.azure.com',
       service: 'azure_pipelines',
@@ -103,7 +103,7 @@ describe('Jenkins CI Params', () => {
         'https://example.azure.comtestOrg/_build/results?buildId=2',
       commit: 'testingsha',
       job: '2',
-      pr: 3,
+      pr: '3',
       project: 'testOrg',
       server_uri: 'https://example.azure.com',
       service: 'azure_pipelines',
@@ -139,7 +139,7 @@ describe('Jenkins CI Params', () => {
         'https://example.azure.comtestOrg/_build/results?buildId=2',
       commit: 'testingmergecommitsha2345678901234567890',
       job: '2',
-      pr: 3,
+      pr: '3',
       project: 'testOrg',
       server_uri: 'https://example.azure.com',
       service: 'azure_pipelines',
@@ -178,7 +178,7 @@ describe('Jenkins CI Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       project: '',
       server_uri: 'https://example.azure.com',
       service: 'azure_pipelines',
diff --git a/test/providers/provider_bitbucket.test.ts b/test/providers/provider_bitbucket.test.ts
index a13159d..c0ef410 100644
--- a/test/providers/provider_bitbucket.test.ts
+++ b/test/providers/provider_bitbucket.test.ts
@@ -59,7 +59,7 @@ describe('Bitbucket Params', () => {
       buildURL: '',
       commit: '',
       job: '1',
-      pr: 0,
+      pr: '',
       service: 'bitbucket',
       slug: '',
     }
@@ -90,7 +90,7 @@ describe('Bitbucket Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '1',
-      pr: 2,
+      pr: '2',
       service: 'bitbucket',
       slug: 'testOwner/testSlug',
     }
@@ -120,7 +120,7 @@ describe('Bitbucket Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '1',
-      pr: 0,
+      pr: '',
       service: 'bitbucket',
       slug: 'testOwner/testSlug',
     }
@@ -150,7 +150,7 @@ describe('Bitbucket Params', () => {
       buildURL: '',
       commit: 'newtestsha',
       job: '1',
-      pr: 0,
+      pr: '',
       service: 'bitbucket',
       slug: 'testOwner/testSlug',
     }
@@ -191,7 +191,7 @@ describe('Bitbucket Params', () => {
       buildURL: '',
       commit: 'overwriteSha',
       job: '1',
-      pr: 4,
+      pr: '4',
       service: 'bitbucket',
       slug: 'overwriteOwner/overwriteRepo',
     }
diff --git a/test/providers/provider_buildkite.test.ts b/test/providers/provider_buildkite.test.ts
index 8ee9023..f57af22 100644
--- a/test/providers/provider_buildkite.test.ts
+++ b/test/providers/provider_buildkite.test.ts
@@ -54,7 +54,7 @@ describe('Buildkite Params', () => {
       buildURL: 'https://buildkite.com/testOrg/testRepo',
       commit: 'testingsha',
       job: '3',
-      pr: 0,
+      pr: '',
       service: 'buildkite',
       slug: 'testRepo',
     }
@@ -86,7 +86,7 @@ describe('Buildkite Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'buildkite',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_circleci.test.ts b/test/providers/provider_circleci.test.ts
index 2fe4618..cce23bd 100644
--- a/test/providers/provider_circleci.test.ts
+++ b/test/providers/provider_circleci.test.ts
@@ -55,7 +55,7 @@ describe('CircleCI Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '3',
-      pr: 1,
+      pr: '1',
       service: 'circleci',
       slug: 'testOrg/testRepo',
     }
@@ -86,7 +86,7 @@ describe('CircleCI Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '3',
-      pr: 1,
+      pr: '1',
       service: 'circleci',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_cirrus.test.ts b/test/providers/provider_cirrus.test.ts
index 7b23221..1fb1434 100644
--- a/test/providers/provider_cirrus.test.ts
+++ b/test/providers/provider_cirrus.test.ts
@@ -55,7 +55,7 @@ describe('Cirrus Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '',
-      pr: 1,
+      pr: '1',
       service: 'cirrus-ci',
       slug: 'https:/example.com/repo',
     }
@@ -92,7 +92,7 @@ describe('Cirrus Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'cirrus-ci',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_codebuild.test.ts b/test/providers/provider_codebuild.test.ts
index 7dd2266..cb51b48 100644
--- a/test/providers/provider_codebuild.test.ts
+++ b/test/providers/provider_codebuild.test.ts
@@ -61,7 +61,7 @@ describe('CodeBuild Params', () => {
         buildURL: '',
         commit: 'testingsha',
         job: '2',
-        pr: 1,
+        pr: '1',
         service: 'codebuild',
         slug: 'repo',
       }
@@ -98,7 +98,7 @@ describe('CodeBuild Params', () => {
         buildURL: '',
         commit: 'testsha',
         job: '2',
-        pr: 7,
+        pr: '7',
         service: 'codebuild',
         slug: 'testOrg/testRepo',
       }
diff --git a/test/providers/provider_drone.test.ts b/test/providers/provider_drone.test.ts
index a371437..4b3d38d 100644
--- a/test/providers/provider_drone.test.ts
+++ b/test/providers/provider_drone.test.ts
@@ -56,7 +56,7 @@ describe('Drone Params', () => {
       buildURL: 'https://www.drone.io/',
       commit: 'testingsha',
       job: '',
-      pr: 1,
+      pr: '1',
       service: 'drone',
       slug: 'https:/example.com/repo',
     }
diff --git a/test/providers/provider_githubactions.test.ts b/test/providers/provider_githubactions.test.ts
index 09447d0..88efe81 100644
--- a/test/providers/provider_githubactions.test.ts
+++ b/test/providers/provider_githubactions.test.ts
@@ -64,7 +64,7 @@ describe('GitHub Actions Params', () => {
         'https://github.com/testOrg/testRepo/actions/runs/2',
       commit: 'testingsha',
       job: 'testWorkflow',
-      pr: 0,
+      pr: '',
       service: 'github-actions',
       slug: 'testOrg/testRepo',
     }
@@ -98,7 +98,7 @@ describe('GitHub Actions Params', () => {
         'https://github.com/testOrg/testRepo/actions/runs/2',
       commit: 'testingsha',
       job: 'testWorkflow',
-      pr: 1,
+      pr: '1',
       service: 'github-actions',
       slug: 'testOrg/testRepo',
     }
@@ -139,7 +139,7 @@ describe('GitHub Actions Params', () => {
         'https://github.com/testOrg/testRepo/actions/runs/2',
       commit: 'testingmergecommitsha2345678901234567890',
       job: 'testWorkflow',
-      pr: 1,
+      pr: '1',
       service: 'github-actions',
       slug: 'testOrg/testRepo',
     }
@@ -180,7 +180,7 @@ describe('GitHub Actions Params', () => {
         'https://github.com/testOrg/testRepo/actions/runs/3',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'github-actions',
       slug: 'testOrg/testRepo',
     }
@@ -219,7 +219,7 @@ describe('GitHub Actions Params', () => {
         'https://github.com/testOrg/testRepo/actions/runs/2',
       commit: 'testingsha',
       job: 'testWorkflow',
-      pr: 1,
+      pr: '1',
       service: 'github-actions',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_gitlabci.test.ts b/test/providers/provider_gitlabci.test.ts
index 25fa937..c83296c 100644
--- a/test/providers/provider_gitlabci.test.ts
+++ b/test/providers/provider_gitlabci.test.ts
@@ -51,7 +51,7 @@ describe('GitLabCI Params', () => {
       buildURL: '',
       commit: '',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'gitlab',
       slug: '',
     }
@@ -88,7 +88,7 @@ describe('GitLabCI Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'gitlab',
       slug: 'testOrg/testRepo',
     }
@@ -118,7 +118,7 @@ describe('GitLabCI Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'gitlab',
       slug: 'testOrg/testRepo',
     }
@@ -208,7 +208,7 @@ describe('GitLabCI Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'gitlab',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_jenkinsci.test.ts b/test/providers/provider_jenkinsci.test.ts
index ada1707..890dbd2 100644
--- a/test/providers/provider_jenkinsci.test.ts
+++ b/test/providers/provider_jenkinsci.test.ts
@@ -63,7 +63,7 @@ describe('Jenkins CI Params', () => {
       buildURL: 'https://example.jenkins.com',
       commit: 'testingsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'jenkins',
       slug: '',
     }
@@ -124,7 +124,7 @@ describe('Jenkins CI Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'jenkins',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_local.test.ts b/test/providers/provider_local.test.ts
index 9aaeb78..57e12f6 100644
--- a/test/providers/provider_local.test.ts
+++ b/test/providers/provider_local.test.ts
@@ -65,7 +65,7 @@ describe('Local Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '',
-      pr: 1,
+      pr: '1',
       service: '',
       slug: 'owner/repo',
     }
diff --git a/test/providers/provider_teamcity.test.ts b/test/providers/provider_teamcity.test.ts
index 689b5d9..c2bba26 100644
--- a/test/providers/provider_teamcity.test.ts
+++ b/test/providers/provider_teamcity.test.ts
@@ -58,7 +58,7 @@ describe('TeamCity Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'teamcity',
       slug: '',
     }
@@ -92,7 +92,7 @@ describe('TeamCity Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'teamcity',
       slug: 'testOrg/testRepo',
     }
@@ -135,7 +135,7 @@ describe('TeamCity Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'teamcity',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_template.test.ts b/test/providers/provider_template.test.ts
index 081f2d0..1ab2d0f 100644
--- a/test/providers/provider_template.test.ts
+++ b/test/providers/provider_template.test.ts
@@ -48,7 +48,7 @@ describe('<Ci> Params', () => {
       buildURL: '',
       commit: '',
       job: '',
-      pr: 0,
+      pr: '',
       service: '',
       slug: '',
     }
@@ -70,7 +70,7 @@ describe('<Ci> Params', () => {
       buildURL: '',
       commit: '',
       job: '',
-      pr: 0,
+      pr: '',
       service: '',
       slug: '',
     }
@@ -97,7 +97,7 @@ describe('<Ci> Params', () => {
       buildURL: '',
       commit: '',
       job: '',
-      pr: 0,
+      pr: '',
       service: '',
       slug: '',
     }
@@ -124,7 +124,7 @@ describe('<Ci> Params', () => {
       buildURL: '',
       commit: '',
       job: '',
-      pr: 0,
+      pr: '',
       service: '',
       slug: '',
     }
diff --git a/test/providers/provider_travisci.test.ts b/test/providers/provider_travisci.test.ts
index b4240e3..7e75ff6 100644
--- a/test/providers/provider_travisci.test.ts
+++ b/test/providers/provider_travisci.test.ts
@@ -74,7 +74,7 @@ describe('TravisCI Params', () => {
       buildURL: '',
       commit: 'testingsha',
       job: '2',
-      pr: 0,
+      pr: '',
       service: 'travis',
       slug: 'testOrg/testRepo',
     }
@@ -110,7 +110,7 @@ describe('TravisCI Params', () => {
       buildURL: '',
       commit: 'testingprsha',
       job: '2',
-      pr: 0,
+      pr: '',
       service: 'travis',
       slug: 'testOrg/testRepo',
     }
@@ -145,7 +145,7 @@ describe('TravisCI Params', () => {
       buildURL: '',
       commit: 'testingprsha',
       job: '2',
-      pr: 0,
+      pr: '',
       service: 'travis',
       slug: 'testOrg/testRepo',
     }
@@ -177,7 +177,7 @@ describe('TravisCI Params', () => {
       buildURL: '',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'travis',
       slug: 'testOrg/testRepo',
     }
diff --git a/test/providers/provider_wercker.test.ts b/test/providers/provider_wercker.test.ts
index 1661024..027f330 100644
--- a/test/providers/provider_wercker.test.ts
+++ b/test/providers/provider_wercker.test.ts
@@ -59,7 +59,7 @@ describe('Wercker CI Params', () => {
       buildURL: 'https://example.com/build',
       commit: 'testingsha',
       job: '',
-      pr: 0,
+      pr: '',
       service: 'wercker',
       slug: 'testOrg/testRepo',
     }
@@ -96,7 +96,7 @@ describe('Wercker CI Params', () => {
       buildURL: 'https://example.com/build',
       commit: 'testsha',
       job: '',
-      pr: 2,
+      pr: '2',
       service: 'wercker',
       slug: 'testOrg/testRepo',
     }