From dd6a3c20cee954020ceeef13c25c3aaf19831a41 Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Thu, 6 Aug 2020 22:09:58 +0200 Subject: [PATCH] feat: make sure versions are kept in sync --- .github/workflows/ci.yml | 3 +++ .github/workflows/keep_versions_synced.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .github/workflows/keep_versions_synced.sh 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