{"action":"created","issue":{"url":"https://api.github.com/repos/travis-ci/travis-ci/issues/9485","repository_url":"https://api.github.com/repos/travis-ci/travis-ci","labels_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/9485/labels{/name}","comments_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/9485/comments","events_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/9485/events","html_url":"https://github.com/travis-ci/travis-ci/issues/9485","id":313926841,"number":9485,"title":"Job with conditional build stages doesn't exclude the stage","user":{"login":"mrchief","id":781818,"avatar_url":"https://avatars3.githubusercontent.com/u/781818?v=4","gravatar_id":"","url":"https://api.github.com/users/mrchief","html_url":"https://github.com/mrchief","followers_url":"https://api.github.com/users/mrchief/followers","following_url":"https://api.github.com/users/mrchief/following{/other_user}","gists_url":"https://api.github.com/users/mrchief/gists{/gist_id}","starred_url":"https://api.github.com/users/mrchief/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrchief/subscriptions","organizations_url":"https://api.github.com/users/mrchief/orgs","repos_url":"https://api.github.com/users/mrchief/repos","events_url":"https://api.github.com/users/mrchief/events{/privacy}","received_events_url":"https://api.github.com/users/mrchief/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-13T00:02:57Z","updated_at":"2018-04-14T14:58:26Z","closed_at":null,"author_association":"NONE","body":"Trying to get travis to skip release stage for PR/non master branch builds but I can't seem to get the recipe right.\r\n\r\nThe travis config is listed [here](https://github.com/dowjones/react-dropdown-tree-select/blob/c93afeef9054ab5ee072243aee85bf8a93e7aa5f/.travis.yml)\r\n\r\n```\r\nlanguage: node_js\r\ncache:\r\n  directories:\r\n    - node_modules\r\nnode_js:\r\n  - '8'\r\n  - '6'\r\nbefore_install:\r\n  - npm install -g npm@5\r\n  - npm install -g greenkeeper-lockfile@1\r\ninstall:\r\n  - yarn install --ignore-engines\r\nbefore_script: greenkeeper-lockfile-update\r\nafter_script: greenkeeper-lockfile-upload\r\nscript:\r\n  - yarn coveralls\r\nbranches:\r\n  except:\r\n    - /^v\\d+\\.\\d+\\.\\d+$/\r\njobs:\r\n  include:\r\n    - if: branch = master\r\n    - stage: release\r\n      node_js: lts/*\r\n      script: echo \"Deploying to npm ...\"\r\n      deploy:\r\n        provider: script\r\n        skip_cleanup: true\r\n        script:\r\n          - npx semantic-release\r\n```\r\nI also tried\r\n\r\n```\r\njobs:\r\n  include:\r\n    - stage: release\r\n      if: branch = master\r\n      node_js: lts/*\r\n      script: echo \"Deploying to npm ...\"\r\n      deploy:\r\n        provider: script\r\n        skip_cleanup: true\r\n        script:\r\n          - npx semantic-release\r\n```\r\n\r\nand\r\n\r\n```\r\njobs:\r\n  include:\r\n    -\r\n      if: branch = master \r\n    - stage: release\r\n      node_js: lts/*\r\n      script: echo \"Deploying to npm ...\"\r\n      deploy:\r\n        provider: script\r\n        skip_cleanup: true\r\n        script:\r\n          - npx semantic-release\r\n```\r\n\r\nbut travis always executes the release stage - it doesn't run npx semantic-release but it still goes through initializing, running tests etc.\r\n\r\nSample [build](https://travis-ci.org/dowjones/react-dropdown-tree-select/builds/365606501)"},"comment":{"url":"https://api.github.com/repos/travis-ci/travis-ci/issues/comments/381334872","html_url":"https://github.com/travis-ci/travis-ci/issues/9485#issuecomment-381334872","issue_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/9485","id":381334872,"user":{"login":"mrchief","id":781818,"avatar_url":"https://avatars3.githubusercontent.com/u/781818?v=4","gravatar_id":"","url":"https://api.github.com/users/mrchief","html_url":"https://github.com/mrchief","followers_url":"https://api.github.com/users/mrchief/followers","following_url":"https://api.github.com/users/mrchief/following{/other_user}","gists_url":"https://api.github.com/users/mrchief/gists{/gist_id}","starred_url":"https://api.github.com/users/mrchief/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrchief/subscriptions","organizations_url":"https://api.github.com/users/mrchief/orgs","repos_url":"https://api.github.com/users/mrchief/repos","events_url":"https://api.github.com/users/mrchief/events{/privacy}","received_events_url":"https://api.github.com/users/mrchief/received_events","type":"User","site_admin":false},"created_at":"2018-04-14T14:58:26Z","updated_at":"2018-04-14T14:58:26Z","author_association":"NONE","body":"But what’s the point in running the release stage on a PR build? \n\nI’m not looking for excluding the build altogether, just the release stage."}}
{"actor":{"display_login":"mrchief"}}