2017-02-16 1 views
1

나는 끌어 오기 요청에 대해 트래비스 Repo를 사용할 수 있습니다. 끌어 오기 요청이 열리면 travis.yml은 테스트와 deploy 스크립트를 모두 트리거합니다.열려있는 끌어 오기 요청에 대해 travis.yml 배포를 건너 뛰시겠습니까?

모든 테스트를 실행하도록 풀 요청을 열었 으면 병합을 제외하고는 배포 스크립트를 실행하지 마십시오.

sudo: true 
language: node_js 
before_deploy: 
    - wget https://s3.amazonaws.com/go-cli/releases/v6.12.4/cf-cli_amd64.deb -qO temp.deb && sudo dpkg -i temp.deb 
    - rm temp.deb 
    - cf login 
    - cf install-plugin autopilot -r CF-Community 
    - npm run build 
deploy: 
- edge: true 
    provider: script 
    script: cf zero-downtime-push app-name -f ./manifest.yml 
    on: 
    branch: master 

답변

2

당신은 빌드가 PR에 대해 트리거되었는지 감지 트래비스 특별한 환경 변수 TRAVIS_PULL_REQUEST 사용할 수 있습니다 아래

travis.yml의 샘플입니다.
https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables

:

... 

deploy: 
- edge: true 
    provider: script 
    script: if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cf zero-downtime-push app-name -f ./manifest.yml; else echo "PR skip deploy"; fi 
    on: 
    branch: master 

더 트래비스 당신이에 faund 수 varibles : 같은

그래서 스크립트는 볼 수