trunk check --ciwill work on any CI provider.
You may also want to specify
--upstreamif, for example, your PRs are not merged into your default branch, but into a
Gitlab performs a shallow clone by default which limits trunk's ability to detect the upstream commit to compute changes from. This is easily solved by simply fetching your main branch before running
git fetch origin main
trunk check --ci
If your default branch is named something else (e.g.
master), you should
fetchthat branch inst
If you host your source code on GitHub, you can also post inline annotations to GitHub.
trunk check --ci --trunk-annotate --github-commit=$(git rev-parse HEAD)
To get a
TRUNK_TOKEN, you'll need to:
- Trunk caches the version of trunk itself, linters, formatters, and lint results, in
- If your build machines are persistent, make sure this directory is not wiped out between CI jobs for best performance. If Trunk has to re-download every linter for every job because this directory is wiped out, it will be very slow.
- If your build machines are ephemeral, there are a few options for caching:
Sometimes you need to bypass a failing
trunk checkjob on an individual pull request. To bypass the failing pull request add
/trunk skip-checkas a comment or in the description of the pull request before Trunk Check runs (if it has already run, restart it).
trunk checkwill still run in this case and report issues, but the job will always return a passing exit code.
If you'd like to setup
trunk checkto run on a hourly/nightly CI run or release branch we recommend running with the following command:
trunk check --all --ci-progress --monitor=false
--ci-progresswill print out the tool's progress every 30 seconds, whereas
--no-progresswill suppress any progress reporting.
You can also explicitly set the upstream branch if needed via
--upstream, but we do detect your main branch by default.