Push trigger - Option to evaluate the last commit only

We are improving the push trigger functionality to provide more precise control over which commits trigger your builds. This improvement allows you to filter based on either all commits in a push or just the most recent commit.

:package: What’s new

Previously, when using the commit_message or changed_files conditions in a push trigger, Bitrise would evaluate all commit messages or changed files included in a single push.

While this behavior is still the default, you can now specify whether you want to evaluate only the last commit in a push.

You can configure this in two ways:

1. UI-based configuration

You can enable this via the UI. See screenshot below.

2. YAML-based configuration

New field: last_commit

Both the commit_message and changed_files trigger conditions now support an optional last_commit boolean parameter:

  • When last_commit: true - Only the most recent commit in a push is evaluated
  • When last_commit: false (default) - All commits in a push are evaluated

New field: Pattern matching

For better consistency with how you configure regex patterns, we’ve also introduced a new pattern field for wildcard matching, similar to the existing regex field:

  • Use pattern for simple wildcard matching (e.g., pattern: "release-*")
  • Use regex for more complex pattern matching with regular expressions

:bulb: Example

Here’s how you can use the new functionality in your bitrise.yml file:

`my_awesome_workflow
  triggers:
    push:
      - branch: main
      - commit_message:
          pattern: "hello"
          last_commit: true
    pull_request:
      - source_branch: "*"`

In this example, a build will be triggered when:

  • A push is made to the main branch, OR
  • A push contains the word “hello” in the last commit message only
  • Any pull request is created or updated

:memo: Please note

  • We’ll continue to support the previous syntax (without the field pattern). So if the user types "hello” right next to the commit_message field, such as commit_message: ‘hello*'.`, it won’t break anything.

  • If you don’t specify the last_commit parameter, the default behavior (evaluating all commits in a push) will be maintained.

Link to docs here

Happy building!