Skip to content

Commit a46f349

Browse files
committed
Split an if() condition to prepare for the next changes
It will be easier to implement the condition where we cache the `.zip` file instead of the extracted files when extracting them into a non-empty directory. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 281092b commit a46f349

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

main.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ async function run(): Promise<void> {
3131
}
3232

3333
let needToDownload = true
34-
try {
35-
if (useCache && (await restoreCache([outputDirectory], cacheId))) {
36-
core.info(`Cached ${cacheId} was successfully restored`)
37-
needToDownload = false
34+
if (useCache) {
35+
try {
36+
if (await restoreCache([outputDirectory], cacheId)) {
37+
core.info(`Cached ${cacheId} was successfully restored`)
38+
needToDownload = false
39+
}
40+
} catch (e) {
41+
core.warning(`Cannot use @actions/cache (${e})`)
42+
useCache = false
3843
}
39-
} catch (e) {
40-
core.warning(`Cannot use @actions/cache (${e})`)
41-
useCache = false
4244
}
4345

4446
if (needToDownload) {

0 commit comments

Comments
 (0)