在Travis构建期间未定义TRAVIS_PULL_REQUEST_BRANCH

时间:2017-06-13 07:22:50

标签: javascript node.js amazon-s3 travis-ci

我正在尝试使用我的js脚本来拉取TRAVIS_PULL_REQUEST_BRANCH值但是当我的js脚本运行时它会出现未定义。不知道我在这里做错了什么:

部署-拉request.js

const chalk = require('chalk'),
  _ = require('lodash'),
  green = chalk.green,
  info = chalk.yellow,
  Deploy = require('./deployApi')

  // require('dotenv').config()

// const { env } = process
  let options = {
    awsKey: process.env.AWS_ACCESS_KEY_ID,
    awsSecret: process.env.AWS_SECRET_ACCESS_KEY,
    localBuildFolder: 'build',
    domain: 'admin-'
}

const branch = process.env.FAKE_PULL_REQUEST_BRANCH || process.env.TRAVIS_PULL_REQUEST_BRANCH

..代码的其余部分......

travis.yml

language: node_js
node_js:
  - 8
cache:
  yarn: true
  directories:
    - node_modules
deploy:
  provider: s3
  access_key_id: $AWS_ACCESS_KEY_ID
  secret_access_key: $AWS_SECRET_ACCESS_KEY
before_script:
  - pip install --user awscli
  - yarn run build
  - yarn run test
script:
  - babel-node ./src/client/deploy/deploy-pull-request.js

0 个答案:

没有答案