diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ac44d1..b5d4385 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,9 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Check if versions are in sync + run: bash .github/workflows/keep_versions_synced.sh + - name: Install dependencies run: pip install pre-commit diff --git a/.github/workflows/keep_versions_synced.sh b/.github/workflows/keep_versions_synced.sh new file mode 100644 index 0000000..96c4aa3 --- /dev/null +++ b/.github/workflows/keep_versions_synced.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +version_package=$(grep '"prettier": "' package.json | sed -n 's/.*"prettier": "\(.*\)"/\1/p') +version_hook=$(grep '\- prettier@' .pre-commit-hooks.yaml | sed -n 's/.*prettier@\(.*\)/\1/p') + + +echo "Checking if versions in package.json and .pre-commit-hooks.yaml are in sync." + +if [ "${version_package}" != "${version_hook}" ]; then + echo "They are out of sync, please resync them." + exit 1 +else + echo "They are in sync." +fi