Search
K

Getting Started

This setup guide will walk you through the initial setup for Trunk Merge.
  1. 1.
    Create a Trunk Account here.
  2. 2.
    Follow the onboarding flow to create an Organization and install the Trunk Github app.
  3. 3.
    Select the repository you would like to use and click Get Started.
  4. 4.
    Navigate to Merge using the navigation pane on the left side of the screen.
  5. 5.
    Enter the name of the target branch and the number of pull requests that can be tested in parallel.
  6. 6.
    Merge uses GitHub status checks to determine whether a pull request can be merged. Configure these checks by adding them to the .trunk/trunk.yaml configuration file in your repository:
    version: 0.1
    cli:
    version: 1.13.0
    merge:
    required_statuses:
    - Trunk Check
    - Unit tests & test coverage
    # Add more required statuses here
  7. 7.
    Set up the required checks by configuring your CI provider to run the required jobs whenever a branch is pushed to your GitHub repository with the special prefix trunk-merge/.
For GitHub actions, that may look like:
name: Run Required Checks
run-name: PR Checks for ${{ github.ref_name }}
on:
push:
branches:
- trunk-merge/**
jobs:
trunk_check:
runs-on: ubuntu-latest
name: Trunk Check
steps:
- name: Checkout
uses: actions/checkout@v3
# Add more steps here...
unit_tests:
runs-on: ubuntu-latest
name: Unit tests & test coverage
steps:
- name: Checkout
uses: actions/checkout@v3
# Add more steps here..
  1. 8.
    Submit a pull request, either using the Trunk CLI or in the GitHub Pull Request UI
GitHub Pull Request View
Trunk CLI
Comment /trunk merge on a pull request
# Authenticate with trunk service
$ trunk login
# Queue pull request for merge
$ trunk merge {pr-number}
In order for the pull request to be properly tested and merged, if there is any kind of branch protection on your repo:
  1. 1.
    Existing branch protection rules must be changed in order to not protect branches in the form of trunk-temp/* and trunk-merge/* . If either of those branches are considered protected in any way according to GitHub (e.g., if there is a */* branch protection rule), then Merge will not be able to run tests properly due to GitHub permission errors.
If there are any questions or help is needed, reach out on our community slack!
Last modified 17d ago