Skip to content

Commit

Permalink
build: Update linting config
Browse files Browse the repository at this point in the history
Skip without token#
  • Loading branch information
janw committed Oct 30, 2024
1 parent 401f189 commit bc48c29
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 248 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,49 @@ on:
jobs:
commitizen:
uses: janw/workflows/.github/workflows/commitizen.yaml@main

pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}

- name: Install poetry
run: pipx install poetry

- name: Set up python environment
uses: actions/setup-python@v5
with:
cache: poetry
python-version: 3.x

- name: Install dependencies
run: poetry install --sync

- id: cache-restore
uses: actions/cache/restore@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-v0|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}

- run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files
shell: bash

- uses: stefanzweifel/git-auto-commit-action@v5
if: >
always()
&& !startsWith(github.event.head_commit.message, 'build(autofix):')
with:
commit_message: "build(autofix): Auto-fix linting issues"
commit_user_name: "Jan Willhaus [bot]"
commit_user_email: "[email protected]"
commit_author: Jan Willhaus [bot] <[email protected]>

- id: cache-save
uses: actions/cache/save@v4
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
path: ~/.cache/pre-commit
34 changes: 23 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
ci:
autoupdate_commit_msg: 'build(pre-commit): pre-commit.ci autoupdate'
autoupdate_schedule: weekly
autofix_commit_msg: 'ci(pre-commit): auto fixes from pre-commit hooks'
autofix_prs: true

default_install_hook_types:
- pre-commit
default_stages:
- pre-commit
repos:
- repo: meta
hooks:
- id: check-hooks-apply

- repo: https://github.com/janw/pre-commit-hooks
rev: v0.1.0
hooks:
- id: sync_ruff_version

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.6.9'
rev: 'v0.7.1'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand All @@ -28,4 +27,17 @@ repos:
- repo: https://github.com/python-poetry/poetry
rev: '1.8.0'
hooks:
- id: poetry-lock
args:
- --no-update
- id: poetry-check

- repo: local
hooks:
- id: mypy
name: mypy
entry: poetry run mypy
language: system
require_serial: true
pass_filenames: false
types: [python]
File renamed without changes.
Loading

0 comments on commit bc48c29

Please sign in to comment.