Skip to content

Commit dd5b204

Browse files
committed
gha: modify validate config extractor to check untracked files
Add a git ls-files --others --exclude-standard check after the existing git diff to catch newly generated files that are not yet tracked. Signed-off-by: Amulyam24 <amulmek1@in.ibm.com>
1 parent 5cc1e4b commit dd5b204

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/validate-config-extractor.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ jobs:
8989
echo "Regenerating chart values to check for drift..."
9090
make sync-chart-values
9191
92-
# Check if any files changed
93-
if git diff --exit-code ../cloud-api-adaptor/install/charts/peerpods/providers/; then
94-
echo "[OK] Generated files are up to date"
95-
else
92+
providers_dir="../cloud-api-adaptor/install/charts/peerpods/providers/"
93+
94+
# Check for modifications to already-tracked files
95+
git diff --exit-code "$providers_dir" || {
9696
echo "::error::Generated chart values are out of sync!"
9797
echo ""
9898
echo "The provider YAML files in install/charts/peerpods/providers/ do not match"
@@ -103,4 +103,20 @@ jobs:
103103
echo ""
104104
echo "Then commit the updated files."
105105
exit 1
106+
}
107+
108+
# Check for newly generated files that are not yet tracked by git
109+
untracked=$(git ls-files --others --exclude-standard "$providers_dir")
110+
if [ -n "$untracked" ]; then
111+
echo "::error::Untracked provider files found — generated filename differs from committed filename:"
112+
echo "$untracked"
113+
echo ""
114+
echo "This usually means a provider's registered name differs from its directory name."
115+
echo "To fix, remove the old files, regenerate, and commit everything:"
116+
echo " git rm \$(git ls-files src/cloud-api-adaptor/install/charts/peerpods/providers/)"
117+
echo " cd src/cloud-providers && make sync-chart-values"
118+
echo " git add ../cloud-api-adaptor/install/charts/peerpods/providers/"
119+
exit 1
106120
fi
121+
122+
echo "[OK] Generated files are up to date"

0 commit comments

Comments
 (0)