Browse Source

CI: Clean up Flatpak cache detection

I discovered while investigating a separate caching issue that the read
command was not assigning ref correctly. This is inconsequential since
we do not use that value, but it led me to look up the documentation for
the GitHub CLI extension used here, gh-actions-cache.

The GitHub CLI extension gh-actions-cache is deprecated as of October
2024. The recommendation is to use the offical gh cache command. That
command produces slightly different output, so adjust the read command
accordingly.
Ryan Foster 7 months ago
parent
commit
1431b4c810
2 changed files with 4 additions and 10 deletions
  1. 2 6
      .github/workflows/build-project.yaml
  2. 2 4
      .github/workflows/publish.yaml

+ 2 - 6
.github/workflows/build-project.yaml

@@ -268,14 +268,10 @@ jobs:
 
           git config --global --add safe.directory "${GITHUB_WORKSPACE}"
 
-          echo '::group::Install actions/gh-actions-cache'
-          gh extension install actions/gh-actions-cache
-          echo '::endgroup::'
-
           cache_key='flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}'
           cache_ref='master'
-          read -r key size unit _ ref _ <<< \
-            "$(gh actions-cache list -B ${cache_ref} --key "${cache_key}-x86_64" | head -1)"
+          read -r id key size unit created accessed <<< \
+            "$(gh cache list --ref "refs/heads/${cache_ref}" --key "${cache_key}-x86_64" | head -1)"
 
           if [[ "${key}" ]]; then
             echo "cacheHit=true" >> $GITHUB_OUTPUT

+ 2 - 4
.github/workflows/publish.yaml

@@ -84,12 +84,10 @@ jobs:
 
           git config --global --add safe.directory "${GITHUB_WORKSPACE}"
 
-          gh extension install actions/gh-actions-cache
-
           cache_key='flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}'
           cache_ref='master'
-          read -r key size unit _ ref _ <<< \
-            "$(gh actions-cache list -B ${cache_ref} --key "${cache_key}-x86_64" | head -1)"
+          read -r id key size unit created accessed <<< \
+            "$(gh cache list --ref "refs/heads/${cache_ref}" --key "${cache_key}-x86_64" | head -1)"
 
           if [[ "${key}" ]]; then
             echo "cacheHit=true" >> $GITHUB_OUTPUT