pre-commit: add hugo-version-check hook
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-09-28 15:55:50 +02:00
parent b023e6bcba
commit 6e25befe64
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -9,6 +9,20 @@ repos:
exclude: .drone.yml # drone's yaml is somewhat strange sometimes exclude: .drone.yml # drone's yaml is somewhat strange sometimes
- repo: local - repo: local
hooks: hooks:
- id: hugo-version-check
name: hugo version check
entry: |
bash -c "
files='.drone.yml Dockerfile'
count=$(grep -oE '( |hugo-v)[0-9].[0-9].[0-9].[0-9]' $files | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/hugo-v//g' | uniq | wc -l)
if [ $count -gt 1 ]; then
echo hugo versions inconsistent:
grep -noE --color=always '( |hugo-v)[0-9].[0-9].[0-9].[0-9]' $files
exit 1
fi
"
language: system
pass_filenames: false
- id: check-compose-file - id: check-compose-file
name: check compose file name: check compose file
language: system language: system