Skip to main content

Configuring build triggers

Existing trigger configurations

This page details information about target-based build triggers, defined within a Workflow or a Pipeline. We recommend this approach for all new users as it offers a more granular and flexible build trigger system.

Existing configurations might use legacy, project-based triggers. Read more about them: Legacy project-based triggers.

Creating build triggersClick to copy link

You create build triggers directly in a Workflow or Pipeline. Such triggers allow a single code event to trigger multiple Workflows or Pipelines. You can create triggers via the UI or in the configuration YAML file.

To create triggers:

  1. Log in to Bitrise and select Bitrise CI on the left, then select your project.

  2. Click the Workflows button on the main page.

    workflows-button.png

  3. Select a Workflow.

  4. Select the Triggers tab on the Workflow's page.

    trigger-in-workflow.png

  5. Select the trigger type and click the Add trigger button.

  6. Configure your trigger in the dialog.

    Click the regex pattern button to turn on regular expressions when defining a value for the trigger condition.

    regex-button.png

  7. When done, click Add trigger.

Adding a new target-based trigger on the Triggers pageClick to copy link

You can quickly add new target-based triggers without leaving the Triggers page. For example, after reviewing your active triggers, you can immediately add another one without switching context, speeding up your setup process.

  1. Go to your project's Triggers page.

  2. If you don't have triggers yet, you’ll see a new Add Trigger button in the middle on the Triggers page. Click Add trigger and fill out the dialog.

    addnewtrigger.png

  3. If you already have target-based triggers, the add trigger button is above the triggers in the top-right corner. Click add trigger and fill out the dialog.

    addanothertrigger.png

Adding a trigger here creates a specific workflow, which then appears under that workflow’s Triggers tab on the Workflows page for easy management.

Disabling a triggerClick to copy link

You can temporarily disable any build trigger. A disabled trigger doesn't trigger builds but retains all configuration information. You can reactivate a disabled trigger at any time.

To disable a build trigger:

  1. Open the Workflow Editor on Bitrise.

  2. Select a Workflow or Pipeline.

  3. On the Workflow page, select the Triggers tab.

    workflow-properties.png

  4. Find the trigger you need and click the vertical ellipsis next to its name.

    workflow-properties-ellipsis.png

  5. Select Disable trigger.

Creating a trigger for the most recent Git commitClick to copy link

By default, when using the Commit message or File change condition in a code push trigger, Bitrise evaluates all commit messages and all changed files included in a single code push.

However, you can configure your triggers to evaluate only the last commit in a push. If a push contains multiple commits, only the most recent one will be evaluated.

  1. Create a new push trigger.

  2. Select either the Commit message or the File change condition.

    last-commit.png

  3. Under the condition, enable Last commit only.

Triggering builds from draft PRsClick to copy link

GitHub and GitLab offers a feature called draft pull request (or merge request in the case of GitLab): when you create a pull request (PR), you can choose to create a pull request that is ready for review or a draft pull request. Draft pull requests cannot be merged, and code owners are not automatically requested to review draft pull requests.

Git provider limitations

This feature is only supported for GitHub and GitLab repositories.

By default, opening a draft PR triggers builds. You can disable this at any time.

If opening a draft PR triggers a build, submitting it for review (converting it to "full" PR, in other words) will not trigger another. You can check out the exact code events that trigger builds depending on the draft PR trigger settings: see topic.

Each separate trigger has its own toggle: you can configure your app so that certain triggers start a build from draft PRs while other triggers don't.

Disabling builds from a draft PRClick to copy link

Skipping Steps if a build is triggered by a draft PR

This guide tells you how to disable triggering builds from a draft PR altogether. You can, however, also skip certain Steps in a build that is triggered by a draft pull request. You just need to use a run_if condition and the GITHUB_PR_IS_DRAFT Environment Variable: for more information, see Enabling or disabling a Step conditionally.

  1. Log in to Bitrise and select Bitrise CI on the left, then select your project.

  2. Click the Workflows button on the main page.

    workflows-button.png

  3. Open your Workflow and select the Triggers tab.

    If you have a Pipeline, you can only disable the setting in the configuration YAML file.

  4. Find the trigger you need and click the vertical ellipsis next to its name.

  5. Select Edit trigger from the menu.

    edit-trigger.png

  6. Uncheck the Include draft pull requests option and click Apply changes.

Build trigger behavior for draft PRsClick to copy link

The table shows whether a build is triggered when a specific action is performed regarding draft PRs, depending on the draft PR trigger settings. For example, converting a draft PR to a PR doesn't trigger a build if the draft PR trigger is enabled but it does trigger a build when it's disabled.

ActionDraft PR trigger is enabledDraft PR trigger is disabled
Open a draft PRtick.svgclose-small.svg
Push a commit to a draft PRtick.svgclose-small.svg
Convert a draft PR to PRclose-small.svgtick.svg
Convert PR to draft PRclose-small.svgclose-small.svg

Supported trigger conditionsClick to copy link

Not all trigger conditions are available for all Git providers. As a general rule, all our trigger conditions are available for the cloud service of the three most frequently used Git providers: GitHub, GitLab, and Bitbucket. For other providers, or self-hosted Git repositories, check out the detailed table for both push triggers and pull request triggers.

Git providerBranchCommit messageFiles changed
GitHub (cloud and self-hosted)tick.svgtick.svgtick.svg
GitLab (cloud and self-hosted)tick.svgtick.svgtick.svg
Bitbucket (cloud and self-hosted)tick.svgtick.svgclose-small.svg
Assemblatick.svgtick.svgclose-small.svg
Deveo (Perforce)tick.svgtick.svgtick.svg
Gogstick.svgtick.svgclose-small.svg
Azure DevOpstick.svgtick.svgclose-small.svg
Git providerSource branchTarget branchLabelsCommentsCommit messageChanged files
GitHub (cloud and self-hosted)tick.svgtick.svgtick.svgtick.svgtick.svgtick.svg
GitLab (cloud and self-hosted)tick.svgtick.svgtick.svgtick.svgtick.svgtick.svg
Bitbucket (cloud and self-hosted)tick.svgtick.svgN/Atick.svgtick.svgtick.svg
Assemblatick.svgtick.svgN/Aclose-small.svgclose-small.svgclose-small.svg
Deveo (Perforce)tick.svgtick.svgclose-small.svgclose-small.svgclose-small.svgclose-small.svg
Gogstick.svgtick.svgclose-small.svgclose-small.svgclose-small.svgclose-small.svg
Azure DevOpstick.svgtick.svgclose-small.svgclose-small.svgclose-small.svgclose-small.svg