@@ -316,6 +316,55 @@ check_license() {
316316 fi
317317}
318318
319+ # Check that files listed in install.yaml project_files/global_files contain #ddev-generated
320+ check_ddev_generated () {
321+ local install_yaml=" install.yaml"
322+
323+ local line entry in_section section dir_file
324+ local list_item_re=' ^[[:space:]]*-[[:space:]]+(.*)'
325+
326+ for section in project_files global_files; do
327+ in_section=false
328+ while IFS= read -r line; do
329+ # Detect section header
330+ if [[ " $line " == " ${section} :" ]]; then
331+ in_section=true
332+ continue
333+ fi
334+
335+ [[ " $in_section " != " true" ]] && continue
336+
337+ # A top-level YAML key (starts with a letter) ends the section
338+ [[ " $line " =~ ^[a-zA-Z] ]] && break
339+
340+ # Match non-commented list entries with any indentation: "- <value>"
341+ [[ " $line " =~ $list_item_re ]] || continue
342+ entry=" ${BASH_REMATCH[1]} "
343+
344+ [[ -z " $entry " ]] && continue
345+
346+ # Skip entries with environment variable interpolation (can't resolve at check time)
347+ [[ " $entry " =~ \$\{ ]] && continue
348+
349+ # For directories, check all files inside recursively
350+ if [[ -d " $entry " ]]; then
351+ while IFS= read -r -d ' ' dir_file; do
352+ if ! grep -q " #ddev-generated" " $dir_file " 2> /dev/null; then
353+ actions+=(" $dir_file (in directory $entry listed in install.yaml $section ) does not contain '#ddev-generated'" )
354+ fi
355+ done < <( find " $entry " -type f -print0 2> /dev/null)
356+ continue
357+ fi
358+
359+ [[ ! -f " $entry " ]] && continue
360+
361+ if ! grep -q " #ddev-generated" " $entry " 2> /dev/null; then
362+ actions+=(" $entry is listed in install.yaml ($section ) but does not contain '#ddev-generated'" )
363+ fi
364+ done < " $install_yaml "
365+ done
366+ }
367+
319368# Check .gitattributes
320369check_gitattributes () {
321370 local gitattributes=" .gitattributes"
@@ -415,6 +464,9 @@ run_checks() {
415464 # Check install.yaml for conditions
416465 check_install_yaml
417466
467+ # Check #ddev-generated in files listed in install.yaml
468+ check_ddev_generated
469+
418470 # Check docker-compose.*.yaml for conditions
419471 check_docker_compose_yaml
420472
0 commit comments