File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 1- name : Image audit
1+ name : Partial audit
22
33# **What it does**: Regularly audits our documentation for unused image files.
44# **Why we have it**: Good hygiene + helps simplify future image audits.
1313 - cron : " 0 0 1 * *"
1414
1515jobs :
16- image -audit :
16+ partial -audit :
1717 permissions :
1818 issues : write
1919 runs-on : ubuntu-latest
2525 - name : Find Unused Files
2626 id : find-files
2727 run : |
28- # Find all files in the partial folder
29- FILES=$(find . -type f \( -name "*.mdx" -o -name "*.md" \) -path "./src/content/partials/* ")
28+ # Find all .mdx files, but only in the ./src/content/partials directory
29+ FILES=$(find ./src/content/partials -type f -name "*.mdx")
3030
3131 # Check if files are referenced in any Render component
3232 UNUSED_FILES=""
@@ -39,10 +39,21 @@ jobs:
3939 SEARCH_PRODUCT="product=\"$PRODUCT\""
4040 SEARCH_FILE="file=\"$FILENAME\""
4141
42+ # --- START LOGGING ---
43+ echo "----------------------------------------"
44+ echo "Checking file: $FILE"
45+ echo " - SEARCH_PRODUCT: $SEARCH_PRODUCT"
46+ echo " - SEARCH_FILE: $SEARCH_FILE"
47+ # --- END LOGGING ---
48+
4249 # Use a chained grep to find lines containing BOTH strings, regardless of order
4350 if ! grep -q -r --exclude-dir=.github "$SEARCH_PRODUCT" --include="*.mdx" . | grep -q "$SEARCH_FILE"; then
4451 UNUSED_FILES+="$FILE\n"
52+ echo " -> UNUSED! Adding to list."
53+ else
54+ echo " -> Used. Skipping."
4555 fi
56+ echo "" # Add a blank line for readability
4657 done
4758
4859 # If there are unused files, output them
You can’t perform that action at this time.
0 commit comments