Chore(Fortune): add pre-commit to check special events

This commit is contained in:
2025-02-17 12:10:37 +08:00
parent 32e3156d30
commit 3a04365e5d
2 changed files with 27 additions and 0 deletions

20
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: local
hooks:
- id: check-special-event
name: check-special-event
entry: bash scripts/check-events.sh
language: system
files: ^fortune_generator/json/.*_special\.json$
types: [json]
pass_filenames: false

7
scripts/check-events.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -e
python3 scripts/check-events.py fortune_generator/json/custom_special.json custom
python3 scripts/check-events.py fortune_generator/json/cyclical_special.json cyclical
python3 scripts/check-events.py fortune_generator/json/static_special.json static