ComPWA / mirrors-taplo

A pre-commit hook for Taplo, a TOML formatter written in Rust

Home Page:https://github.com/tamasfe/taplo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Taplo mirror

code style: prettier

Mirror of Taplo for pre-commit, created with a modified version of pre-commit-mirror-maker (see this workflow).

Using Taplo with pre-commit

Add this to your .pre-commit-config.yaml

repos:
  - repo: https://github.com/ComPWA/mirrors-taplo
    rev: ""
    hooks:
      - id: taplo

then run

pre-commit autoupdate --repo https://github.com/ComPWA/mirrors-taplo

Using Taplo with pre-commit via Docker

Add this to your .pre-commit-config.yaml

repos:
  - repo: https://github.com/ComPWA/mirrors-taplo
    rev: ""
    hooks:
      - id: taplo-docker

then run

pre-commit autoupdate --repo https://github.com/ComPWA/mirrors-taplo

Docker container

Since it can take a several minutes to install the taplo hook, this repository also provides a Docker container with caches for the taplo pre-commit hook for each tag. Here's an example of how to use this container in your GitHub Actions:

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

jobs:
  cleanup:
    container:
      image: ghcr.io/compwa/mirrors-taplo:v0.8.0
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.github_token }}
    name: Run taplo through pre-commit
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3
      - run: git config --global --add safe.directory $(pwd)
      - env:
          PRE_COMMIT_HOME: /root/.cache/pre-commit
        run: |
          pre-commit run taplo -a

WARNING: the cache is only effective if the tag of the container is the same as the tag of the pre-commit hook in your .pre-commit-config.yaml.

About

A pre-commit hook for Taplo, a TOML formatter written in Rust

https://github.com/tamasfe/taplo


Languages

Language:Dockerfile 96.9%Language:Rust 3.1%