-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cd228c
commit 8f6a018
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,11 @@ jobs: | |
<img src="https://preview.ourmap.us/pr/${{ env.PR_NUM }}/sprites/sprite.png" /> | ||
<img src="https://preview.ourmap.us/pr/${{ env.PR_NUM }}/sprites/[email protected]" /> | ||
## Map sample differences | ||
" > pr_preview.md | ||
echo pr/sample_differences.md >> pr_preview.md | ||
- uses: tibdex/github-app-token@v1 | ||
id: checks_token | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
# Compare two folders of images and produce an .md file of differences | ||
|
||
# Check if the right number of arguments are passed | ||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 <folder1> <folder2>" | ||
exit 1 | ||
fi | ||
|
||
FOLDER1="$1" | ||
FOLDER2="$2" | ||
OUTPUT_FOLDER="samples-diff" | ||
|
||
# Create the output folder if it doesn't exist | ||
mkdir -p "$OUTPUT_FOLDER" | ||
|
||
# Loop through files in FOLDER1 | ||
for file in "$FOLDER1"/*.png; do | ||
# Extract just the base filename without the path | ||
basefile=$(basename "$file") | ||
|
||
# Check if file exists in FOLDER2 | ||
if [ -e "$FOLDER2/$basefile" ]; then | ||
# Compare the files | ||
cmp -s "$FOLDER1/$basefile" "$FOLDER2/$basefile" | ||
|
||
# If files are different ($? is the exit status of last command, 1 means different for cmp) | ||
if [ $? -eq 1 ]; then | ||
# Copy the files to the output folder with the appropriate naming scheme | ||
cp "$FOLDER1/$basefile" "$OUTPUT_FOLDER/${basefile%.*}_before.png" | ||
cp "$FOLDER2/$basefile" "$OUTPUT_FOLDER/${basefile%.*}_after.png" | ||
fi | ||
fi | ||
done | ||
|
||
OUTPUT_MD="sample_differences.md" | ||
|
||
# Start the table with headers | ||
echo "| Sample Name | Before | After |" > $OUTPUT_MD | ||
echo "|-------------|--------|-------|" >> $OUTPUT_MD | ||
|
||
# Loop through *_before.png files in the output folder | ||
for before_file in "$OUTPUT_FOLDER"/*_before.png; do | ||
# Extract just the base filename without the path and the '_before' suffix | ||
basefile=$(basename "$before_file" _before.png) | ||
|
||
# Construct the path to the corresponding after file | ||
after_file="$OUTPUT_FOLDER/${basefile}_after.png" | ||
|
||
# Check if the after file exists | ||
if [ -e "$after_file" ]; then | ||
# Add an entry to the markdown table | ||
echo "| $basefile | ![before]($before_file) | ![after]($after_file) |" >> $OUTPUT_MD | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters