diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 722a9d42..5535a5fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,8 @@ jobs: - name: Lint and type-check run: | npx turbo lint type-check + - name: Validate Grats generated files are up-to-date + run: ./scripts/validate-grats.sh - name: Run tests run: | touch packages/skin-database/config.js diff --git a/scripts/validate-grats.sh b/scripts/validate-grats.sh new file mode 100755 index 00000000..1d6b7dd8 --- /dev/null +++ b/scripts/validate-grats.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Script to validate that Grats generated files are up-to-date +# This ensures that developers have run Grats locally and committed the generated files + +set -e + +echo "🔍 Validating Grats generated files are up-to-date..." + +# Run Grats to regenerate schema files +echo "Running Grats to regenerate schema files..." +npx turbo run grats --filter=skin-database + +# Check if the generated files were modified +CHANGES=$(git status --porcelain packages/skin-database/api/graphql/) + +if [ -n "$CHANGES" ]; then + echo "❌ Grats generated files are out of date!" + echo "" + echo "The following generated files have changes after running Grats:" + echo "$CHANGES" + echo "" + echo "Please run the following command locally and commit the changes:" + echo " npx turbo run grats --filter=skin-database" + echo "" + echo "Diff of changes:" + git diff packages/skin-database/api/graphql/ + exit 1 +else + echo "✅ Grats generated files are up-to-date" +fi