diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d0337b68273..178cdc83d38 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,7 +26,9 @@ jobs: - name: Generate code env: NODE_OPTIONS: "--max-old-space-size=4096" - run: make gen + run: | + make gen + make validate-clients-untracked-files - name: Checks validator env: GOLANGCI_LINT_FLAGS: --out-format github-actions diff --git a/Makefile b/Makefile index 144e2a860a6..057d1ca8223 100644 --- a/Makefile +++ b/Makefile @@ -357,3 +357,6 @@ help: ## Show Help menu # helpers gen: gen-ui gen-api gen-code clients gen-docs + +validate-clients-untracked-files: + scripts/verify_clients_untracked_files.sh diff --git a/scripts/verify_clients_untracked_files.sh b/scripts/verify_clients_untracked_files.sh new file mode 100755 index 00000000000..1900513599e --- /dev/null +++ b/scripts/verify_clients_untracked_files.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -euo pipefail + +echo "Checking for untracked files in 'clients/'..." + +if git status --porcelain clients/ | grep -E '^\?\?'; then + cat << EOF +Error: Untracked files found in the 'clients/' directory. + +The 'clients/' directory contains auto-generated code that must be tracked in Git. Untracked files suggest new files were created and need to be added. + +To resolve this: + +1. Remove the 'clients/' directory: + rm -fr clients/ + +2. Restore 'clients/' to the last commit: + git restore -- clients/ + +3. Regenerate files in 'clients/': + make gen + +4. Stage the regenerated files: + git add clients/ + +5. Commit the changes: + git commit -m 'Regenerate clients/ files' +EOF + exit 1 +else + echo "No untracked files found." + exit 0 +fi