Build and Deploy only on PR request Accept

Hi,

We are testing a Project with the workflow using GitHub, CircleCI and deployment to Pantheon upstream. At present, We could see that the CircleCI pipeline gets triggered when a Pull request is created. What we are trying to achieve is

  1. Need to run the pipeline which includes the PHP code sniffer and other tests when a pull request is created by developer. Once the pull request is created, the pipeline will be executed and the output of the tests will be shown in CircleCI and GitHub.

  2. As the next step, After Manual code review, the TL approves the pull request, The developers feature branch will be merged to the main branch (May be the ‘develop’ branch) and we will need the pipeline to be trigger but not with the tests but with the ‘build’ and ‘deploy’ part in the pipeline. How to trigger the pipeline when a PR request is accepted?

So,

  1. When a Pull request is created - The ‘tests’ part of the pipeline needs to be executed
  2. When a Pull request is accepted - The ‘build’ and the ‘deployment’ part of the pipeline needs to be executed.

Please let us know how we could achieve this?

Hi @sandeep-sasikumar,

  1. You can use the Only Build Pull Requests feature to trigger a pipeline when a pull request is created. You can use branch level job execution with the ignore key to ignore your develop branch.

  2. You can add your develop branch as a default branch so that a build is triggered upon a merge of a PR. You can use branch filtering and logic statements which can be used on a steps level or workflow level depending on your needs.

Let me know if you have any additional questions.

Hello @Henna ,

Thank you for the update.

I have few questions as mentioned below.

  1. Does CircleCI charge based on the number of user accounts. Suppose if i have 10 developers working on the project and have access to the GitHub repository and does all of them require access to the CircleCI account to trigger the CircleCI pipeline based on the pull request they create in GitHub?

  2. Also, Is it possible for disable all triggers based on pull requests created in CircleCI and only trigger the pipeline when a change occurs on (develop, QA, Stage and Master branches) selected branches. For example, Suppose if a developer works on a feature branch and creates a pull request to merge his changes to the develop branch, We don’t want the pipeline to be executed but when the TL reviews the code and then accepts the Pull Request, We will need to run the pipeline. The same way we will need to trigger the pipeline when a change is merged in to QA branch or stage branch or Master branch.

Please confirm.