mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
Prefer cached icon copies over ipfs (#2463)
This commit is contained in:
parent
b29eb61945
commit
27f9739710
23
.github/workflows/pr_checks.yml
vendored
23
.github/workflows/pr_checks.yml
vendored
|
@ -23,6 +23,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
files: _data/icons/*.json
|
files: _data/icons/*.json
|
||||||
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
|
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
|
||||||
|
|
||||||
|
- name: Get changed icon blobs
|
||||||
|
id: changed-icon-blobs
|
||||||
|
uses: tj-actions/changed-files@v35
|
||||||
|
with:
|
||||||
|
files: _data/iconsDownload/*
|
||||||
|
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
|
||||||
|
|
||||||
- run: sudo apt-get -y install jq curl exiftool
|
- run: sudo apt-get -y install jq curl exiftool
|
||||||
|
|
||||||
|
@ -33,13 +40,23 @@ jobs:
|
||||||
|
|
||||||
BAD=0
|
BAD=0
|
||||||
|
|
||||||
|
CHANGED_ICON_BLOBS=(${{ steps.changed-icon-blobs.outputs.all_changed_files }})
|
||||||
|
|
||||||
for CHANGED_FILE in ${{ steps.changed-icons.outputs.all_changed_files }}; do
|
for CHANGED_FILE in ${{ steps.changed-icons.outputs.all_changed_files }}; do
|
||||||
echo "Checking icon $CHANGED_FILE"
|
echo "Checking icon $CHANGED_FILE"
|
||||||
URL=$(cat "$CHANGED_FILE" | jq '.[0].url' -r)
|
URL=$(cat "$CHANGED_FILE" | jq '.[0].url' -r)
|
||||||
if [[ "$URL" =~ ^ipfs://([A-Za-z0-9]+)$ ]]; then
|
if [[ "$URL" =~ ^ipfs://([A-Za-z0-9]+)$ ]]; then
|
||||||
echo "Trying to download the image..."
|
IPFS_HASH=${BASH_REMATCH[1]}
|
||||||
curl -Lo icon "https://cloudflare-ipfs.com/ipfs/${BASH_REMATCH[1]}" 2>/dev/null
|
|
||||||
METADATA=$(exiftool icon -json)
|
if [[ "${CHANGED_ICON_BLOBS[*]} " =~ "_data/iconsDownload/$IPFS_HASH " ]]; then
|
||||||
|
TARGET_FILE="_data/iconsDownload/$IPFS_HASH"
|
||||||
|
else
|
||||||
|
echo "Trying to download the image..."
|
||||||
|
TARGET_FILE=icon
|
||||||
|
curl -Lo icon "https://cloudflare-ipfs.com/ipfs/$IPFS_HASH" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
METADATA=$(exiftool $TARGET_FILE -json)
|
||||||
|
|
||||||
SCHEMA_WIDTH=$(cat "$CHANGED_FILE" | jq '.[0].width' -r)
|
SCHEMA_WIDTH=$(cat "$CHANGED_FILE" | jq '.[0].width' -r)
|
||||||
SCHEMA_HEIGHT=$(cat "$CHANGED_FILE" | jq '.[0].height' -r)
|
SCHEMA_HEIGHT=$(cat "$CHANGED_FILE" | jq '.[0].height' -r)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user