Skip to content

Commit 43a29c3

Browse files
committed
fix: only commit files that actually changed
1 parent dc8a848 commit 43a29c3

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

.github/workflows/update-dumps.yml

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -357,41 +357,36 @@ jobs:
357357
steps:
358358
- name: Checkout repository
359359
uses: actions/checkout@v5
360-
- name: Download all dump artifacts
361-
uses: actions/download-artifact@v4
362-
with:
363-
path: artifacts
364-
- name: Organize dump outputs
365-
run: |
366-
mv artifacts/itemfinder/items-imgs.zip finders/items/items-imgs.zip
367-
mv artifacts/itemfinder/id.txt finders/items/data/id.txt
368-
mv artifacts/itemfinder/item.txt finders/items/data/item.txt
369-
mv artifacts/items/items.zip jsons/item-definitions.zip
370-
mv artifacts/npcs/npcs.zip map/npcs_helper.zip
371-
mv artifacts/map/map.zip map/map.zip
372-
mv artifacts/objects/objects.zip map/objects.zip
373-
mv artifacts/collision/collision.zip map/collision.zip
374-
mv artifacts/heightmap/heightmap.zip map/heightmap.zip
375-
rm -r artifacts/
376-
377360
- name: Set up Git
378361
run: |
379362
git config --global user.name "Wasp Bot"
380363
git config --global user.email "[email protected]"
381-
382-
- name: Commit changes if any
383-
id: commit
364+
- name: Download all dump artifacts
365+
uses: actions/download-artifact@v4
366+
with:
367+
path: artifacts
368+
- name: Organize dump outputs and stage changes
384369
run: |
385-
git checkout -B update-${{ inputs.cache_version }}
386-
git add .
387-
# Check if there are any changes
388-
if git diff --cached --quiet; then
389-
echo "No changes detected"
390-
echo "changed=false" >> $GITHUB_OUTPUT
391-
else
392-
git commit -m "Update cache dumps to version ${{ inputs.cache_version }}"
393-
echo "changed=true" >> $GITHUB_OUTPUT
394-
fi
370+
declare -A files=(
371+
["artifacts/itemfinder/items-imgs.zip"]="finders/items/items-imgs.zip"
372+
["artifacts/itemfinder/id.txt"]="finders/items/data/id.txt"
373+
["artifacts/itemfinder/item.txt"]="finders/items/data/item.txt"
374+
["artifacts/items/items.zip"]="jsons/item-definitions.zip"
375+
["artifacts/npcs/npcs.zip"]="map/npcs_helper.zip"
376+
["artifacts/map/map.zip"]="map/map.zip"
377+
["artifacts/objects/objects.zip"]="map/objects.zip"
378+
["artifacts/collision/collision.zip"]="map/collision.zip"
379+
["artifacts/heightmap/heightmap.zip"]="map/heightmap.zip"
380+
)
381+
for src in "${!files[@]}"; do
382+
dst="${files[$src]}"
383+
mkdir -p "$(dirname "$dst")"
384+
if [ ! -f "$dst" ] || ! cmp -s "$src" "$dst"; then
385+
mv "$src" "$dst"
386+
git add "$dst"
387+
fi
388+
done
389+
rm -rf artifacts/
395390
396391
- name: Create Pull Request if changes
397392
if: steps.commit.outputs.changed == 'true'

0 commit comments

Comments
 (0)