How to configure Travis-CI to build pull requests & merges to master w/o redundancy

前端 未结 6 451
一整个雨季
一整个雨季 2021-01-30 08:20

To put it in \"BDD\" terms:

Background:
Given I\'m contributing to a GH repo

When I create a pull request
Then Travis shou

6条回答
  •  温柔的废话
    2021-01-30 08:52

    I eventually found another GH issue (#2111) which gave me the idea to try enabling both PRs & pushes, but with a whitelist to restrict pushes to a specific branch. This seems to satisfy the criteria for my workflow. Here's what I did:

    1. Enable both PRs & branch pushes in the Travis settings for the repo:

    1. Change .travis.yml to white-list master branch (i.e. only build pushes to master):
    branches:
      only: 
        - master
    
    1. Test it by creating a PR with the .travis.yml change, and another PR with some empty commits to verify it works for forks too.

    2. Verify successful merge commit build from master.

提交回复
热议问题