Skip to content

Commit e3d1169

Browse files
committed
fix: Recheck after actions/cache
1 parent b759a67 commit e3d1169

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

action.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ runs:
4141
fi
4242
echo "sbt_cachekey=$RUNNER_OS-$RUNNER_ARCH-sbt-runner-$SBT_RUNNER_VERSION-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT"
4343
echo "sbt_diskcachekey=$RUNNER_OS-$RUNNER_ARCH-java$JDK_VERSION-sbt-diskcache-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT"
44-
- name: Check Tool Cache
44+
- name: Check tool cache
4545
id: cache-tool-dir
4646
shell: bash
4747
env:
@@ -60,6 +60,19 @@ runs:
6060
with:
6161
path: ${{ steps.cache-paths.outputs.sbt_toolpath }}
6262
key: ${{ steps.cache-paths.outputs.sbt_cachekey }}
63+
- name: Check runner cache
64+
id: cache-tool-dir2
65+
shell: bash
66+
env:
67+
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
68+
run: |
69+
# actions/cache seems to be buggy on Windows, so double check if restore worked
70+
if [[ -f "$SBT_TOOLPATH/sbt/bin/sbt" ]]; then
71+
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
72+
else
73+
mkdir -p "$SBT_TOOLPATH"
74+
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
75+
fi
6376
- name: sbt 2.x disk cache
6477
id: disk-cache
6578
if: inputs.disk-cache == 'true'
@@ -74,7 +87,7 @@ runs:
7487
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }}
7588
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
7689
SBT_DOWNLOADPATH: "${{ steps.cache-paths.outputs.sbt_downloadpath }}"
77-
if: steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
90+
if: steps.cache-tool-dir2.outputs.cache-hit != 'true'
7891
run: |
7992
mkdir -p "$SBT_DOWNLOADPATH"
8093
curl -sL "https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip" > \
@@ -89,7 +102,7 @@ runs:
89102
- name: "Verify the sbt distribution signature"
90103
id: "ampel-verify"
91104
# Skip on Windows/macOS until go-billy path fix lands: https://github.com/go-git/go-billy/issues/194
92-
if: runner.os == 'Linux' && steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
105+
if: runner.os == 'Linux' && steps.cache-tool-dir2.outputs.cache-hit != 'true'
93106
uses: carabiner-dev/actions/ampel/verify@2a4b2cd115ede14629b03ef7e77586d3269d4c72 # v1.2.3
94107
with:
95108
policy: "git+https://github.com/carabiner-dev/policies#signature/signature.json"

0 commit comments

Comments
 (0)