lib/utils.js
function processEnv (config) {
  // Grab the CI stuff from env
  config.computed.ci.buildNumber = getEnv(config.ci.env.buildNumber)
  config.computed.ci.prNumber = getEnv(config.ci.env.pr, 'false')
  config.computed.ci.isPr = config.computed.ci.prNumber !== 'false'
  config.computed.ci.branch = getEnv(config.ci.env.branch, 'master')

  logger.log(`pr-bumper::config: prNumber [${config.computed.ci.prNumber}], isPr [${config.computed.ci.isPr}]`)

  // Fill in the owner/repo from the repo slug in env if necessary
  const repoSlug = getEnv(config.ci.env.repoSlug)

  if (repoSlug) {
    const parts = repoSlug.split('/')
    if (!config.vcs.repository.owner) {
      config.vcs.repository.owner = parts[0]
    }

    if (!config.vcs.repository.name) {
      config.vcs.repository.name = parts[1]
    }
  }

  // Grab the VCS stuff from the env
  config.computed.vcs.auth = {
    password: getEnv(config.vcs.env.password),
    readToken: getEnv(config.vcs.env.readToken),
    username: getEnv(config.vcs.env.username),
    writeToken: getEnv(config.vcs.env.writeToken)
  }
}
function processEnv (config) {
  // Grab the CI stuff from env
  config.computed.ci.buildNumber = getEnv(config.ci.env.buildNumber)
  config.computed.ci.prNumber = getEnv(config.ci.env.pr, 'false')
  config.computed.ci.isPr = config.computed.ci.prNumber !== 'false'
  config.computed.ci.branch = getEnv(config.ci.env.branch, 'master')

  logger.log(`pr-bumper::config: prNumber [${config.computed.ci.prNumber}], isPr [${config.computed.ci.isPr}]`)

  // Fill in the owner/repo from the repo slug in env if necessary
  const repoSlug = getEnv(config.ci.env.repoSlug)

  if (repoSlug) {
    const parts = repoSlug.split('/')
    if (!config.vcs.repository.owner) {
      config.vcs.repository.owner = parts[0]
    }

    if (!config.vcs.repository.name) {
      config.vcs.repository.name = parts[1]
    }
  }

  // Grab the VCS stuff from the env
  config.computed.vcs.auth = {
    password: getEnv(config.vcs.env.password),
    readToken: getEnv(config.vcs.env.readToken),
    username: getEnv(config.vcs.env.username),
    writeToken: getEnv(config.vcs.env.writeToken)
  }
}
function processEnv ( config ) { // Grab the CI stuff from env config . computed . ci . buildNumber = getEnv ( config . ci . env . buildNumber ) config . computed . ci . prNumber = getEnv ( config . ci . env . pr , 'false' ) config . computed . ci . isPr = config . computed . ci . prNumber !== 'false' config . computed . ci . branch = getEnv ( config . ci . env . branch , 'master' ) logger . log ( ` ${ config . computed . ci . prNumber } ${ config . computed . ci . isPr } ` ) // Fill in the owner/repo from the repo slug in env if necessary const repoSlug = getEnv ( config . ci . env . repoSlug ) if ( repoSlug ) { const parts = repoSlug . split ( '/' ) if ( ! config . vcs . repository . owner ) { config . vcs . repository . owner = parts [ 0 ] } if ( ! config . vcs . repository . name ) { config . vcs . repository . name = parts [ 1 ] } } // Grab the VCS stuff from the env config . computed . vcs . auth = { password : getEnv ( config . vcs . env . password ) , readToken : getEnv ( config . vcs . env . readToken ) , username : getEnv ( config . vcs . env . username ) , writeToken : getEnv ( config . vcs . env . writeToken ) } }
Process the environment variable sections in the config and fill in the computed properties within it
@param {Config} config - the config object to process (will be mutated in-place)
Process the environment variable sections in the config and fill in the computed properties within it