Getting Started
Getting started with the older legacy Trunk Merge
This guide will walk you through running Trunk Merge in your GitHub repository.
Connect your Trunk organization to GitHub
Sign up at app.trunk.io, create a Trunk organization, and connect it to your GitHub repositories. If your repository is already connected to your Trunk organization, this step can be skipped.
Set Up Trunk Merge
Specify the branch that pull requests will be merged into (usually
main
ormaster
) and the number of pull requests Trunk Merge is allowed to concurrently run tests for.\Tell Trunk Merge how to determine whether a pull request can be merged by specifying the name of the GitHub status checks or jobs it should require to passs in
.trunk/trunk.yaml
in your repository.Ensure the checks and jobs in
merge.required_statuses
from.trunk/trunk.yaml
specified in step 2 run whenever Trunk Merge tests a PR. Trunk Merge creates branches with the prefixtrunk-merge/
in order to tests PRs, so this means configuring your CI provider to run them whenever a branch with that prefix is pushed to. For GitHub Actions, that'll mean setting up apush
-triggered workflow, filtered totrunk-merge/**
branches, like so:\
Adjust GitHub Branch Protection Rules
In order for Trunk Merge to function properly:
The Trunk GitHub App must be allowed to merge PRs if merging into your branch is restricted
Branches following the pattern
trunk-merge/*
andtrunk-temp/*
must not be protected by GitHub. The app does not run with admin permissions, so it cannot interact with protected branchesSquash merges must be allowed into your repository, as Trunk Merge squash merges PRs
Use Trunk Merge
Now that you're done with setup, take it for a spin! You can submit a pull request to Trunk Merge by either commenting /trunk merge
on the PR in GitHub or using the CLI.
Comment /trunk merge
on a pull request
Debugging Trunk Merge
If Trunk Merge is having issues creating branches, running tests, or merging pull requests:
Make sure you've followed every step in "Set Up Trunk Merge".
Ensure that there are no branch protection rules affecting
trunk-temp/*
andtrunk-merge/*
branches. If branch protection is configured in GitHub for any branch matching those formats (e.g. if there is a*/*
branch protection rule), then that will prevent Trunk Merge from running tests for pull requests.
If there are any questions or help is needed, reach out on our community slack!
Last updated