From f1cc80b458c22d7009bcbf90378afea930ca563b Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 12:07:34 +1100 Subject: [PATCH 01/10] Use standard GITHUB_TOKEN secret for auth --- .github/workflows/check-mod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 496d7297..5d8356a9 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -22,9 +22,9 @@ jobs: - name: Identify Changed Mods id: find-changed-mods run: | - # Get the list of files changed in the PR using GitHub API with PAT + # Get the list of files changed in the PR using GitHub API API_RESPONSE=$(curl -s -X GET \ - -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files") From 204ea23843179bc0e303069c831b6c00ef3fc3d7 Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 12:07:57 +1100 Subject: [PATCH 02/10] Cache and use cached ImageMagick --- .github/workflows/check-mod.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 5d8356a9..fa976077 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -14,7 +14,15 @@ jobs: with: fetch-depth: 0 # Get full history for comparing changes - - name: Install ImageMagick + - name: Cache ImageMagick + uses: actions/cache@v3 + with: + path: /usr/bin/identify + key: imagemagick-cache-${{ runner.os }}-${{ hashFiles('**/check-mod.yml') }} + restore-keys: imagemagick-cache-${{ runner.os }}- + + - name: Install ImageMagick (if not cached) + if: steps.cache.outputs.cache-hit != 'true' run: | sudo apt-get update sudo apt-get install -y imagemagick From 8f20655524715500e909321636145240934135b7 Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 12:42:34 +1100 Subject: [PATCH 03/10] Cache ImageMagick with awalsh128/cache-apt-pkgs-action --- .github/workflows/check-mod.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index fa976077..990705cf 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -14,18 +14,10 @@ jobs: with: fetch-depth: 0 # Get full history for comparing changes - - name: Cache ImageMagick - uses: actions/cache@v3 + - name: Use ImageMagick from cache + uses: awalsh128/cache-apt-pkgs-action@v1 with: - path: /usr/bin/identify - key: imagemagick-cache-${{ runner.os }}-${{ hashFiles('**/check-mod.yml') }} - restore-keys: imagemagick-cache-${{ runner.os }}- - - - name: Install ImageMagick (if not cached) - if: steps.cache.outputs.cache-hit != 'true' - run: | - sudo apt-get update - sudo apt-get install -y imagemagick + packages: imagemagick - name: Identify Changed Mods id: find-changed-mods @@ -35,7 +27,7 @@ jobs: -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files") - + # Debug the API response echo "Debug - API Response Type: $(echo "$API_RESPONSE" | jq -r 'type')" echo "Debug - First 300 chars of response: $(echo "$API_RESPONSE" | head -c 300)" From 5f0094b92a2a5f3b11fbf2de734e6b8e84eb4f8e Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 12:42:51 +1100 Subject: [PATCH 04/10] Remove debug print statements --- .github/workflows/check-mod.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 990705cf..af2201ad 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -28,10 +28,6 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files") - # Debug the API response - echo "Debug - API Response Type: $(echo "$API_RESPONSE" | jq -r 'type')" - echo "Debug - First 300 chars of response: $(echo "$API_RESPONSE" | head -c 300)" - # Use fallback method if API fails if echo "$API_RESPONSE" | jq -e 'if type=="array" then true else false end' > /dev/null; then echo "Using GitHub API method to find changed files" From 1e3ece042c3667dda21864df70e277ab3c37684d Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 12:57:36 +1100 Subject: [PATCH 05/10] Enable `continue-on-error` for JSON validation features to allow multiple problems to be reported with a single run --- .github/workflows/check-mod.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index af2201ad..5a01cfd1 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -110,6 +110,7 @@ jobs: done < changed_mods.txt - name: Validate JSON Format + continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | # Use jq to validate each JSON file @@ -123,6 +124,7 @@ jobs: done < changed_mods.txt - name: Validate meta.json Against Schema + continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' uses: dsanders11/json-schema-validate-action@v1.2.0 with: @@ -130,6 +132,7 @@ jobs: files: ${{ steps.find-changed-mods.outputs.meta_json_files }} - name: Validate Download URLs + continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | while read -r mod_path; do From ee58011ee5cdeb07248193c90f2310728165442e Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 13:25:40 +1100 Subject: [PATCH 06/10] Debug cache installation failing --- .github/workflows/check-mod.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 5a01cfd1..3e349a68 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -18,6 +18,12 @@ jobs: uses: awalsh128/cache-apt-pkgs-action@v1 with: packages: imagemagick + execute_install_scripts: true + + - name: DEBUG Check cache restore state + run: | + ls -gh /usr/bin + ls -gh /usr/local/bin - name: Identify Changed Mods id: find-changed-mods @@ -96,7 +102,7 @@ jobs: if [ -f "$THUMBNAIL" ]; then # Extract width and height using ImageMagick - DIMENSIONS=$(identify -format "%wx%h" "$THUMBNAIL") + DIMENSIONS=$(/usr/bin/identify -format "%wx%h" "$THUMBNAIL") WIDTH=$(echo "$DIMENSIONS" | cut -dx -f1) HEIGHT=$(echo "$DIMENSIONS" | cut -dx -f2) From 49edd9f34efc981ed7d970e43bbf5e56225ee108 Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 13:39:59 +1100 Subject: [PATCH 07/10] Set and use fixed ImageMagick version 8:6.9.12.98 --- .github/workflows/check-mod.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 3e349a68..ac49852b 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -18,12 +18,7 @@ jobs: uses: awalsh128/cache-apt-pkgs-action@v1 with: packages: imagemagick - execute_install_scripts: true - - - name: DEBUG Check cache restore state - run: | - ls -gh /usr/bin - ls -gh /usr/local/bin + version: 8:6.9.12.98+dfsg1-5.2build2 - name: Identify Changed Mods id: find-changed-mods @@ -102,7 +97,7 @@ jobs: if [ -f "$THUMBNAIL" ]; then # Extract width and height using ImageMagick - DIMENSIONS=$(/usr/bin/identify -format "%wx%h" "$THUMBNAIL") + DIMENSIONS=$(/usr/bin/identify-im6.q16 -format "%wx%h" "$THUMBNAIL") WIDTH=$(echo "$DIMENSIONS" | cut -dx -f1) HEIGHT=$(echo "$DIMENSIONS" | cut -dx -f2) From 3492447e90caa7c96a1e7e3a97be2c524897155f Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 13:53:20 +1100 Subject: [PATCH 08/10] Enable `continue-on-error` for thumbnail dimension check --- .github/workflows/check-mod.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index ac49852b..1442bf3f 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -88,6 +88,7 @@ jobs: done < changed_mods.txt - name: Check Thumbnail Dimensions + continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | while read -r mod_path; do @@ -96,7 +97,8 @@ jobs: THUMBNAIL="$mod_path/thumbnail.jpg" if [ -f "$THUMBNAIL" ]; then - # Extract width and height using ImageMagick + # Extract width and height using ImageMagick identify + # Using identify-im6.q16 directly as identify is a symlink that is not created by the cache restoration DIMENSIONS=$(/usr/bin/identify-im6.q16 -format "%wx%h" "$THUMBNAIL") WIDTH=$(echo "$DIMENSIONS" | cut -dx -f1) HEIGHT=$(echo "$DIMENSIONS" | cut -dx -f2) From 08c6c6365aa046dc2400a168539ec61e3f5f802b Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 14:03:58 +1100 Subject: [PATCH 09/10] Disable `continue-on-error` for all tasks as failed jobs are confusingly marked as successful by GitHub --- .github/workflows/check-mod.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 1442bf3f..5ceee573 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -88,7 +88,6 @@ jobs: done < changed_mods.txt - name: Check Thumbnail Dimensions - continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | while read -r mod_path; do @@ -113,7 +112,6 @@ jobs: done < changed_mods.txt - name: Validate JSON Format - continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | # Use jq to validate each JSON file @@ -127,7 +125,6 @@ jobs: done < changed_mods.txt - name: Validate meta.json Against Schema - continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' uses: dsanders11/json-schema-validate-action@v1.2.0 with: @@ -135,7 +132,6 @@ jobs: files: ${{ steps.find-changed-mods.outputs.meta_json_files }} - name: Validate Download URLs - continue-on-error: true if: steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | while read -r mod_path; do From ab58eeab361dbc59fe247c7d15f3c77af9bbf399 Mon Sep 17 00:00:00 2001 From: Breezebuilder Date: Thu, 27 Mar 2025 14:05:44 +1100 Subject: [PATCH 10/10] Set task conditions to use always() to sidestep baffling GitHub design choices --- .github/workflows/check-mod.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 5ceee573..9258eb33 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -88,7 +88,7 @@ jobs: done < changed_mods.txt - name: Check Thumbnail Dimensions - if: steps.find-changed-mods.outputs.changed_mods_found == 'true' + if: always() && steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | while read -r mod_path; do if [ -d "$mod_path" ]; then @@ -112,7 +112,7 @@ jobs: done < changed_mods.txt - name: Validate JSON Format - if: steps.find-changed-mods.outputs.changed_mods_found == 'true' + if: always() && steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | # Use jq to validate each JSON file while read -r mod_path; do @@ -125,14 +125,14 @@ jobs: done < changed_mods.txt - name: Validate meta.json Against Schema - if: steps.find-changed-mods.outputs.changed_mods_found == 'true' + if: always() && steps.find-changed-mods.outputs.changed_mods_found == 'true' uses: dsanders11/json-schema-validate-action@v1.2.0 with: schema: "./schema/meta.schema.json" files: ${{ steps.find-changed-mods.outputs.meta_json_files }} - name: Validate Download URLs - if: steps.find-changed-mods.outputs.changed_mods_found == 'true' + if: always() && steps.find-changed-mods.outputs.changed_mods_found == 'true' run: | while read -r mod_path; do if [ -d "$mod_path" ]; then