From dfb2eba7ec06eada27694ec25476d6d6cdf771a8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 7 Jun 2026 08:15:26 +0000 Subject: [PATCH] fix(workflow): implement .cleanup-ignore support in automated cleanup - Add logic to parse .cleanup-ignore in Detect unused scripts step - Skip ignored files (by basename or path) during unused script detection - Report skipped file count to GITHUB_STEP_SUMMARY - Close PR #422 as it was incorrectly flagging ignored files Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com> --- .github/workflows/cleanup.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index a37c3b7..2fa1a49 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -68,9 +68,34 @@ jobs: markdown_list="" raw_list="" + # Load .cleanup-ignore entries + ignored_files=() + skipped_count=0 + if [ -f ".cleanup-ignore" ]; then + while IFS= read -r line || [[ -n "$line" ]]; do + # Skip comments and empty lines + [[ "$line" =~ ^#.*$ || -z "$line" ]] && continue + ignored_files+=("$line") + done < ".cleanup-ignore" + fi + for script in scripts/*.sh; do if [ -f "${script}" ]; then script_name=$(basename "${script}") + + # Check if the file is in .cleanup-ignore + skip=false + for ignored in "${ignored_files[@]}"; do + if [ "${script}" = "${ignored}" ] || [ "${script_name}" = "${ignored}" ]; then + skip=true + break + fi + done + if [ "$skip" = true ]; then + ((skipped_count++)) + continue + fi + refs=$(grep -r "${script_name}" . \ --include="*.yml" --include="*.yaml" \ --include="*.sh" --include="*.md" \ @@ -105,6 +130,12 @@ jobs: echo "## Temp/Debug Files" echo "${old_files}" fi + + if [ "${skipped_count}" -gt 0 ]; then + echo "" + echo "## Ignored Files" + echo "Skipped ${skipped_count} files based on .cleanup-ignore" + fi } >> "${GITHUB_STEP_SUMMARY}" echo "unused_files_list<> "${GITHUB_OUTPUT}"