diff --git a/scripts/check-sample-files.sh b/scripts/check-sample-files.sh index c88b21ae..246908bd 100755 --- a/scripts/check-sample-files.sh +++ b/scripts/check-sample-files.sh @@ -23,6 +23,13 @@ for dir in ./samples/*/; do echo " - [ ] ${dir}compose.yaml is not valid according to \`defang compose config\`: $output" fi ) + + # Ensure the name: in Compose matches the sample/folder name + sample_name=$(basename "$dir") + compose_name=$(grep -E '^name:' "${dir}compose.yaml" | awk '{print $2}') + if [[ "$sample_name" != "$compose_name" ]]; then + echo " - [ ] fix name: in ${dir}compose.yaml to be '$sample_name' (currently '$compose_name')" + fi fi # Check that we NOT have a .github/workflows/deploy.yaml file; it's generated from templates/deploy.yaml