Skip to content

Commit

Permalink
CI: verify no untracked files in the clients folder (#7905)
Browse files Browse the repository at this point in the history
* add verify_clients_untracked_files.sh

* fix job

* review fixes

* add make target
  • Loading branch information
yonipeleg33 authored Jun 20, 2024
1 parent ce49db6 commit e58e606
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 34 additions & 0 deletions scripts/verify_clients_untracked_files.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e58e606

Please sign in to comment.