Skip to content

Commit

Permalink
ci: setup pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Oct 10, 2024
1 parent 7617d3a commit 7458ab8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files
continue-on-error: true # Continue even if pre-commit fails

# Commit all changed files back to the repository
- uses: stefanzweifel/git-auto-commit-action@v5
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
# Those are not supported by biomejs yet, refer https://biomejs.dev/internals/language-support/
types_or: [html, css, markdown]
description: "Prettify files for the files which Biomejs doesn't support yet"
- repo: https://github.com/biomejs/pre-commit
rev: "v0.5.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@1.9.3"]
description: "Format, organize imports, lint, and apply safe fixes to the committed files"

0 comments on commit 7458ab8

Please sign in to comment.