- Notifications
You must be signed in to change notification settings - Fork0
A GitHub action to install and run treefmt on your repo
License
isbecker/treefmt-action
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This action installs and runstreefmt
on your repository.
Currently, if you run this action on a Windows-based runner, it will use the oldertreefmt
version 0.6.1.This is because the newer versions oftreefmt
are not yet supported on Windows.
I would recommend using a Linux-based runner if you want to use the latest version oftreefmt
.I doubt you will need to run this action on Windows anyway, as it is intended for CI/CD pipelines.
This example is more or less taken from thetest.ymlworkflow in this repo.
name:Format Codeon:[push, pull_request]jobs:format:runs-on:ubuntu-lateststeps: -uses:actions/checkout@v2# setup some formatters -uses:biomejs/setup-biome@v2.2.1 -uses:uncenter/setup-taplo@v1.0.8 -name:Run treefmtuses:isbecker/treefmt-action@v1with:github_token:${{ secrets.GITHUB_TOKEN }}version:'latest'ci:true
Note that you need to set up the formatters you want to use before runningtreefmt
.Many formatters are available as actions on the GitHub Marketplace.
Optional The version oftreefmt
to install. Default"latest"
.
Required GitHub token for accessing the API.
Optional Path to thetreefmt
configuration file. Default"treefmt.toml"
.
Optional Do not exit with error if a configured formatter is missing. Default"false"
.
Optional Run as iftreefmt
was started in the specified working directory instead of the current working directory. Default"."
.
Optional Ignore the evaluation cache entirely. Useful for CI. Default"false"
.
Optional Exit with error if any changes were made. Useful for CI. Default"false"
.
Optional Specify formatters to apply. Defaults to all formatters.
Optional The root directory from whichtreefmt
will start walking the filesystem.
Optional File to search for to find the project root (if--tree_root
is not passed).
Optional The method used to traverse the files within--tree_root
. Supports 'auto', 'git' or 'filesystem'. Default"auto"
.
Optional Set the verbosity of logs e.g.-vv
. Default"false"
.
Optional Log paths that did not match any formatters at the specified log level. Default"warn"
.
About
A GitHub action to install and run treefmt on your repo