1. Resources
  2. /
  3. Plugins
  4. /
  5. branch-commit-buildkite-plugin

Branch Commit Buildkite Plugin

A Buildkite plugin that verifies the build commit exists on the specified branch. Designed for UI-triggered builds where a user may select a commit that doesn’t belong to the target branch.

The plugin only runs when BUILDKITE_SOURCE is ui. For all other build sources it exits immediately.

Options

Optional

mode (string)

Controls what happens when the commit is not found on the branch. Defaults to strict.

  • warn — logs a warning and continues the build
  • strict — fails the build with an error

Examples

In warn mode:

steps:
  - label: ":pipeline:"
    command: buildkite-agent pipeline upload
    plugins:
      - branch-commit#v1.0.0:
          mode: "warn"

In strict mode (the default — mode can be omitted):

steps:
  - label: ":pipeline:"
    command: buildkite-agent pipeline upload
    plugins:
      - branch-commit#v1.0.0:
          mode: "strict"

Shallow clones

When the repository is a shallow clone (e.g., when using the sparse-checkout plugin), the plugin runs git fetch --unshallow to retrieve enough commit history for ancestry validation. In partial clone environments (--filter=blob:none), this only downloads commit metadata and is inexpensive. In non-partial shallow clones, this downloads the full repository history, which may be slow on large repositories.

Developing

Run tests locally:

docker run -it --rm -v "$PWD:/plugin:ro" buildkite/plugin-tester

Run shellcheck:

docker run --rm -v "$PWD:/mnt" --workdir "/mnt" koalaman/shellcheck:stable hooks/* lib/*.bash

Validate plugin structure:

docker run -it --rm -v "$PWD:/plugin:ro" buildkite/plugin-linter --id branch-commit --path /plugin

Contributing

  1. Fork the repository and create a feature branch
  2. Add tests for any new functionality
  3. Ensure all tests pass and shellcheck reports no warnings
  4. Open a pull request

License

The package is available as open source under the terms of the MIT License.

The plugins listed on this webpage are provided for informational purposes only. They have not undergone any formal security review or assessment. While we strive to provide useful resources, we cannot guarantee the safety, reliability, or integrity of these plugins. Users are strongly advised to conduct their own security evaluations before downloading, installing, or using any plugin. By using these plugins, you acknowledge and accept any risks associated with their use. We disclaim any liability for any harm or damages arising from the use of the plugins listed.

Start turning complexity into an advantage

Create an account to get started for free.

Buildkite Pipelines

Platform

  1. Pipelines
  2. Public pipelines
  3. Test Engine
  4. Package Registries
  5. Mobile Delivery Cloud
  6. Pricing

Hosting options

  1. Self-hosted agents
  2. Mac hosted agents
  3. Linux hosted agents

Resources

  1. Docs
  2. Blog
  3. Changelog
  4. Example pipelines
  5. Plugins
  6. Webinars
  7. Case studies
  8. Events
  9. Migration Services
  10. CI/CD perspectives

Company

  1. About
  2. Careers
  3. Press
  4. Security
  5. Brand assets
  6. Contact

Solutions

  1. Replace Jenkins
  2. Workflows for MLOps
  3. Testing at scale
  4. Monorepo mojo
  5. Bazel orchestration

Legal

  1. Terms of Service
  2. Acceptable Use Policy
  3. Privacy Policy
  4. Subprocessors
  5. Service Level Agreement
  6. Supplier Code of Conduct
  7. Modern Slavery Statement

Support

  1. System status
  2. Forum
© Buildkite Pty Ltd 2026