crabby-merge

Crates.iocrabby-merge
lib.rscrabby-merge
version0.6.0
sourcesrc
created_at2021-05-21 20:01:50.338874
updated_at2024-03-05 15:12:49.387542
descriptionA utility to poll open Bitbucket PR's and merge them based on a configurable trigger.
homepagehttps://github.com/kesyog/crabby-merge
repositoryhttps://github.com/kesyog/crabby-merge
max_upload_size
id400474
size110,009
Kesavan Yogeswaran (kesyog)

documentation

https://github.com/kesyog/crabby-merge

README

crabby-merge

build status crates.io Apache 2.0 license

Scans open Bitbucket pull requests for a configurable trigger string and merges them for you.

This is largely a ripoff port of polly-merge into async Rust. There's a bit of speedup gained, but this is mostly just an uncreative excuse to try out async/await in Rust 👨🏽‍🎓

Installation

Install via Cargo:

cargo install crabby-merge

Usage

Ideally, you'd schedule crabby-merge to be run periodically. To accomplish this with cron, on a Unix-like machine, run crontab -e and add an entry like:

# Schedule crabby-merge to run every two minutes
*/2 * * * * $HOME/.cargo/bin/crabby-merge

Configuration

TOML

In $HOME/.crabby_merge.toml:

# base URL of the Bitbucket server to query. Required.
bitbucket_url = "your URL goes here"
# API token for user authentication
bitbucket_api_token = "your token goes here"
# Trigger regex string to look for
merge_trigger = "^:shipit:$"
# Whether to check the pull request description for the trigger
check_description = true
# Whether to check pull request comments for the trigger. Only the user's own comments are searched.
check_comments = false
# Whether to include the user's own pull requests
check_own_prs = true
# Whether to search pull requests the user has approved
check_approved_prs = false

All fields are optional unless indicated. Values shown are the default values.

Environment variables

Each of the TOML keys listed above can be prefixed with CRABBY_MERGE and provided as an environment variable. Keys are case-insensitive.

For example, you can pass in the bitbucket API token as CRABBY_MERGE_API_TOKEN=<your token here>.

Jenkins rebuild support

There is experimental support for rebuilding failed Jenkins builds whose name matches a provided regex trigger. This is a sad workaround for flaky blocking tests. This is compile-time gated by the jenkins feature, which is enabled by default.

To use it, add the following fields to your configuration file. If these fields aren't provided, the retry functionality will be disabled at runtime.

jenkins_username = ""
jenkins_password = ""
# Regex trigger to search against the build name
jenkins_retry_trigger = ""
# Optional. Defaults to 10.
jenkins_retry_limit = ""
Commit count: 22

cargo fmt