[Product Update] Trigger pipelines on pushes to non-draft PR

It is now possible to configure pipelines to be triggered only on pushes to non-draft Pull Requests.

This functionality improves on the historic “Only build pull requests” feature, and lets you optimize costs further by only running pipelines when strictly needed.

See documentation.

Who Can Use This?

This functionality is available to all customers that use GitHub.

  • If your organization slug (check Org Settings > Overview) looks like github/org-name, then read below the section "Getting started for OAuth orgs"
  • If your organization slug looks like circleci/ID, or if you have already set up GitHub App pipelines and triggers, then read the section “Getting started for orgs connected through GitHub App”

Getting started for OAuth orgs

  1. Go to your project’s Project Settings > Pipelines, and create a new pipeline that points to your .circleci/config.yml file
    • In order to complete this action, an admin in your GitHub organization must install the CircleCI GitHub App. Installation only needs to be done once to grant access to the entire org.
  2. Go to Project Settings > Triggers, and create a GitHub App trigger. In the “run on” menu, select “pushes to open non-draft PR”
  3. At this stage, you effectively have two triggers: a OAuth one and a GitHub App one. We need to remove the OAuth one to avoid duplicated pipelines.
  4. Go to your project in GitHub > Settings > Webhooks, and delete the CirlceCI webhook manually (it will say: https://circleci.com/hooks/github)
    • If you change your mind and want to re-enable the OAuth trigger, go to Project Settings > Overview, click “stop building” at the bottom, then click “Follow”. The webhook will be re-created.
  5. Done :sparkles: Your pipeline now will run only on pushes to non-draft PRs

Getting started for orgs connected through GitHub App

  1. Open any of your existing GitHub App triggers from Project Settings > Triggers
  2. In the “run on” menu, select event “pushes to open non-draft PR”
  3. Done :sparkles:Your pipeline now will run only on pushes to non-draft PRs

For any questions/feedback, feel free to respond in this thread or reach out directly to benedetta@circleci.com.

1 Like