From 1110219cf706ab263a29e9aec82f64ccb76553d9 Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Mon, 22 Aug 2022 17:06:28 +1200 Subject: [PATCH] Only restore submodules on exact match Only restore git submodules if we have an exact match, otherwise we will restore outdated submodules over newer ones, then save the outdated version with the exact match after. --- .github/actions/cache-submodules/action.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/cache-submodules/action.yaml b/.github/actions/cache-submodules/action.yaml index 2eb3170..f27cee9 100644 --- a/.github/actions/cache-submodules/action.yaml +++ b/.github/actions/cache-submodules/action.yaml @@ -17,11 +17,12 @@ runs: working-directory: addons/godot_xterm/native/thirdparty shell: bash run: | + cache_version=1 # Increment this number to invalidate the cache. godot_cpp_rev=$(git ls-tree HEAD godot-cpp --object-only) libuv_rev=$(git ls-tree HEAD libuv --object-only) libtsm_rev=$(git ls-tree HEAD libtsm --object-only) hash_cmd=$([[ $RUNNER_OS == 'Windows' ]] && echo 'sha1sum' || echo 'shasum') - hash_of_hashes=$(echo -n "$godot_cpp_rev$libuv_rev$libtsm_rev" | $hash_cmd | head -c 40) + hash_of_hashes=$(echo -n "$godot_cpp_rev$libuv_rev$libtsm_rev$cache_version" | $hash_cmd | head -c 40) echo "::set-output name=hash::$hash_of_hashes" - name: Cache submodules uses: actions/cache@v3 @@ -29,6 +30,3 @@ runs: with: path: addons/godot_xterm/native/thirdparty key: thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }} - restore-keys: | - thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-${{ inputs.target }}- - thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-