Update CI to check for XMP rather than EXIF - for PNGs only (#9435)

Addresses GIMP metadata editing limitations
This commit is contained in:
doofus-01 2024-10-27 10:40:00 -07:00 committed by GitHub
parent b26f446d32
commit ccb079f05c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,9 +27,9 @@ jobs:
with:
fetch-depth: 0
- name: check image metadata
- name: check image EXIF metadata
run: |
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.(webp|png|je?pg)$')
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.(webp|je?pg)$')
# cycle through the changed image files, make sure they have the right fields
for file in "${image_files[@]}"; do
# check Artist tag, fail if missing
@ -56,3 +56,33 @@ jobs:
;;
esac
done
- name: check png XMP metadata
run: |
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.png$')
# cycle through the changed image files, make sure they have the right fields
for file in "${image_files[@]}"; do
# check Creator tag, fail if missing
artist="$(exiftool -p '$XMP:Creator' "$file")"
if [ "$artist" ]; then
printf 'Creator tag in %s is %s\n' "$file" "$artist"
else
printf 'no Creator XMP tag in %s\n' "$file"
exit 1
fi
# check Rights tag, fail if missing or wrong type
copyright="$(exiftool -p '$XMP:Rights' "$file")"
case $copyright in
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
printf 'Rights tag in %s is %s\n' "$file" "$copyright"
;;
'')
printf 'no Rights XMP tag in %s\n' "$file"
exit 1
;;
*)
printf 'Rights tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
exit 1
;;
esac
done