Skip to content

Commit

Permalink
chore: configure Pre-commit runs and auto-updates (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
paduszyk authored May 22, 2024
1 parent a425c96 commit e2565dc
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/pre-commit-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Pre-commit: Run"

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

jobs:
pre-commit-run:
name: Run Pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Pre-commit: Update"

on:
schedule:
- cron: 0 0 * * 1

jobs:
pre-commit-update:
name: Update Pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: pip
- run: python -m pip install --upgrade pip
- run: python -m pip install pre-commit
- run: pre-commit autoupdate
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.CREATE_PR_ACTION_TOKEN }}
branch: chore/pre-commit-update
commit-message: "chore(deps): update Pre-commit hooks"
title: "chore(deps): update Pre-commit hooks"
body: |
Automated changes by [@peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) action.
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Pre-commit
# https://pre-commit.com

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
hooks:
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
args:
- --no-error-on-unmatched-pattern
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: "v0.13.0"
hooks:
- id: markdownlint-cli2
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# django-xlsx-serializer

[![Pre-commit](https://img.shields.io/github/actions/workflow/status/paduszyk/django-xlsx-serializer/pre-commit-run.yml?style=flat-square&label=pre-commit&logo=pre-commit)][pre-commit]

[![Prettier](https://img.shields.io/badge/code%20style-prettier-1E2B33?style=flat-square&logo=Prettier)][prettier]
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-fa6673.svg?style=flat-square&logo=conventional-commits)][conventional-commits]

Expand All @@ -14,4 +16,5 @@ Released under the [MIT license][license].
[conventional-commits]: https://www.conventionalcommits.org/en/v1.0.0/
[license]: https://github.com/paduszyk/django-xlsx-serializer/blob/main/LICENSE
[paduszyk]: https://github.com/paduszyk
[pre-commit]: https://github.com/paduszyk/django-xlsx-serializer/actions/workflows/pre-commit-run.yml
[prettier]: https://prettier.io
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ dynamic = ["version"]
"Repository" = "https://github.com/paduszyk/django-xlsx-serializer"

[project.optional-dependencies]
dev = []
dev = [
"pre-commit < 4",
]

# Setuptools
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
Expand Down

0 comments on commit e2565dc

Please sign in to comment.