Skip to content

Commit

Permalink
ci: add pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
kmnhan committed Aug 15, 2024
1 parent 53d3c99 commit d4f29bf
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.x"


- name: Install package
run: |
python -m pip install --upgrade pip
python -m pip install -v .
- name: Run commitizen
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
id: cz
Expand Down
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ci:
autoupdate_commit_msg: "ci(pre-commit): pre-commit autoupdate"
autofix_commit_msg: "style: pre-commit auto fixes [...]"
autoupdate_schedule: monthly

default_install_hook_types: [pre-commit, commit-msg]

repos:

# Meta hooks
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

# Security & credential scanning/alerting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

# Lint and format with ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.6
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

# # Commitizen
# - repo: https://github.com/commitizen-tools/commitizen
# rev: v3.28.0
# hooks:
# - id: commitizen
# - id: commitizen-branch
# stages: [push]

0 comments on commit d4f29bf

Please sign in to comment.