Reference

Submitting Pull Requests

Users can submit pull requests to Merge in two ways: using the Trunk CLI or via a comment in the GitHub pull request UI.

Submitting with Trunk CLI

To submit a pull request to Merge with the Trunk CLI, a user must first be logged in. Run trunk login and follow the prompts to log in. After logging in, pull requests can be submitted by PR number: trunk merge {pr-number}.

544544

Submitting via a comment in the GitHub pull request UI

Commenting /trunk merge on a pull request will submit it to be merged.

913913

Cancelling Pull Requests

Cancelling with the Trunk CLI

Similar to submitting new pull requests, a user can remove an existing pull request from the queue by running trunk cancel {pr-number

Cancelling a comment in the GitHub pull request UI

A pull request can be removed from the queue by commenting /trunk cancel

Parallelism

To keep pull request throughput high, Merge can test multiple pull requests simultaneously. This is done by creating a branch for a pull request from the HEAD of the target branch along with the changes from the pull request and any that are ahead of it. This branch is the predicted state of the repository if the pull requests ahead of this one pass all the required checks.

To configure how many pull requests are tested in parallel, navigate to Settings > Repositories > Repo-Name and update the value.

888888

Required Status Checks

Merge uses GitHub status checks to determine whether a pull request can be merged. Whenever a pull request passes branch protection rules, Merge will wait for the required status checks to be posted to the test branch. You can configure these checks by adding them to the trunk.yaml configuration file in your repository. For example:

version: 0.1
cli:
  version: 0.17.0-beta
merge:
  required_statuses:
    - Trunk Check
    - Unit tests & test coverage
    - Integration tests

If no required checks are specified for your repository, Merge will merge pull requests once they have passed branch protection rules.

Running Required Checks

In order to merge a pull request, the test branch created by Merge must be passing all required status checks. When a pull request is ready to be tested, Merge creates a temporary test branch with the name prefix trunk-merge/ You should configure your CI jobs to run when a branch is created with the prefix trunk-merge/. Once those jobs post the status checks to GitHub, Merge will either pass or fail the pull request.

GitHub Branch Protection Rules

Merge monitors GitHub's branch protection rules and doesn't push a test branch for a pull request until it has passed all rules and is mergeable. You can find more information about why a pull request hasn't entered the queue by clicking on it in the Merge UI at app.trunk.io.

579579

Most repository maintainers will want to use the GitHub branch protection settings to limit who can merge pull requests. By restricting who can merge to admins and the Github Trunk App, you can prevent contributors from circumventing Merge and merging code directly.
Merge does account for admins needing to merge pull requests directly, effectively skipping Merge entirely. If a pull request is submitted without using Trunk Merge, the service will restart tests on all pull requests with the updated target branch.

Pausing your queue

You may occasionally need to prohibit pull requests from merging for some maintenance or emergency intervention. Admins can pause the queue by running trunk merge pause or toggling the state in the application settings. Running trunk merge resume or toggling the setting back to running will allow Merge to pick up where it left off. Keep in mind, if any pull requests were merged while the service was paused, pull requests in the queue will be restarted.


Did this page help you?