Two builds per commit to pull request

Niels Lohmann's Avatar

Niels Lohmann

18 Aug, 2021 12:06 PM

In project, everything works fine with AppVeyor - thanks for the great service!

If someone else creates a merge request, I see one build per commit which is as expected.

However, if I create a merge request myself, I see two builds per commit which is rather unfortunate, as a single build takes more than two hours to complete.

  1. Support Staff 1 Posted by Feodor Fitsner on 18 Aug, 2021 04:38 PM

    Feodor Fitsner's Avatar

    Builds are invoked by a webhook. Those builds are not identical: one of them is for branch and another one is PR. When you push to a branch with opened PR webhook sends two requests: branch "push" and PR "sync". You can avoid building branch if there is an opened PR by adding this to your appveyor.yml:

    skip_branch_with_pr: true
  2. 2 Posted by Niels Lohmann on 18 Aug, 2021 05:58 PM

    Niels Lohmann's Avatar

    Thanks for the quick response. I added line

    skip_branch_with_pr: true

    and created a pull request, see, yet still see again two builds created and pending.

    Is this expected as the change to the configuration is not yet merged to the default branch?

  3. Support Staff 3 Posted by Feodor Fitsner on 18 Aug, 2021 06:03 PM

    Feodor Fitsner's Avatar

    Right, it should be merged into default branch.

  4. 4 Posted by Niels Lohmann on 18 Aug, 2021 06:52 PM

    Niels Lohmann's Avatar

    I merged the change to the default branch and created a new PR. Again, I see two builds created (see screenshot).

    What am I missing?

    See and

  5. Support Staff 5 Posted by Feodor Fitsner on 18 Aug, 2021 06:55 PM

    Feodor Fitsner's Avatar

    Looks correct to me. You created a new branch, did a push - build of the branch started. You opened a new PR - another build started. Now, if you do another push into feature branch with open PR only PR build will be started.

  6. Support Staff 6 Posted by Feodor Fitsner on 18 Aug, 2021 06:56 PM

    Feodor Fitsner's Avatar

    You can disable PR builds all together if you don't need them.

  7. 7 Posted by Niels Lohmann on 18 Aug, 2021 07:04 PM

    Niels Lohmann's Avatar

    I see. This is confusing, because GitHub Actions only create one build for such an action.

    You say I can disable PR builds - how would this affect PRs created by other people?

  8. Support Staff 8 Posted by Feodor Fitsner on 18 Aug, 2021 07:10 PM

    Feodor Fitsner's Avatar

    No PR builds would be started at all which is, of course, not what we expect from CI for OSS project.

    Could you please elaborate what you mean under "such an action"? Typical workflow would be: create feature branch, do some commits to that branch, push - branch build started. Do another commits into feature branch, push it - another branch build started. Open a new PR for the feature branch - new PR build is started. How is GitHub Actions different?

  9. 9 Posted by Niels Lohmann on 18 Aug, 2021 07:14 PM

    Niels Lohmann's Avatar

    The screenshot show the runs created by GitHub actions. You see 4 runs (one for each workflow) - no workflow has been triggered twice. They have only been started once the PR has been created. Once the PR is merged to the main branch, another 4 runs will be created. This is the behavior I would also like to see from AppVeyor. However, I see 2 builds per commit to a PR - only when it is merged, I only see 1 build.

  10. Support Staff 10 Posted by Feodor Fitsner on 18 Aug, 2021 07:19 PM

    Feodor Fitsner's Avatar

    I see. Then, if you only need to run builds for PRs and merges into the main branch you can add branch filtering:, to allow only builds to master/main.

  11. 11 Posted by Niels Lohmann on 18 Aug, 2021 07:21 PM

    Niels Lohmann's Avatar

    So I would add

        - develop

    and remove skip_branch_with_pr?

  12. Support Staff 12 Posted by Feodor Fitsner on 18 Aug, 2021 07:23 PM

    Feodor Fitsner's Avatar

    Yep, it should do the trick.

  13. 13 Posted by Niels Lohmann on 19 Aug, 2021 02:11 PM

    Niels Lohmann's Avatar

    Yes, this works now!

    Thanks a lot for the support!

  14. Support Staff 14 Posted by Feodor Fitsner on 19 Aug, 2021 04:31 PM

    Feodor Fitsner's Avatar

    You are welcome! Saw "JSON for Modern C++" release announcement on HN today - cool stuff :)

  15. Feodor Fitsner closed this discussion on 19 Oct, 2021 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac