Skip to content

Commit

Permalink
docs: add fetch in script
Browse files Browse the repository at this point in the history
  • Loading branch information
addetz committed Oct 23, 2024
1 parent 02c01f1 commit b22f94f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/find-unused-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ echo "Checking for unused image files in static/assets/docs/images folder..."
# Trim the path static/assets/docs/images.
find static/assets/docs/images -type f ! -name ".DS_STORE" ! -name ".DS_Store" | sed 's|static/assets/docs/images||g' > all_images.json

# Fetch all branches
git fetch --all

# List all the version branches
branches="master"
version_branches=$(git branch --list "version-[0-9]-[0-9]")
branches+=" $version_branches"

for current_branch in $branches; do
git checkout $current_branch
echo "Current branch: $current_branch"
git pull
git checkout origin/$current_branch

find docs -type f -name "*.md" -exec grep -Hn "\.webp" {} + > docs_used_images.json
find _partials -type f -name "*.mdx" -exec grep -Hn "\.webp" {} + > partials_used_images.json
Expand Down

0 comments on commit b22f94f

Please sign in to comment.