Skip to content

Commit f76c204

Browse files
committed
fix: disable caching by default
1 parent ad44d25 commit f76c204

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
token:
1414
description: GitHub access token or a Personal Access Token with 'repo' scope
1515
default: ${{ github.token }}
16+
cache:
17+
description: Runtime switch to enable/disable caching because GitHub is debugging issues in their caching API
18+
default: false
1619

1720
runs:
1821
using: node16

src/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ async function installGitHubReleaseBinary(
4141
octokit: Octokit,
4242
targetBinary: TargetBinary,
4343
storageDirectory: string,
44+
enableCache: boolean,
4445
token: string
4546
): Promise<void> {
4647
const targetTriple = getTargetTriple(arch(), platform());
@@ -74,7 +75,10 @@ async function installGitHubReleaseBinary(
7475
releaseTag,
7576
targetTriple,
7677
].join("-");
77-
const restoreCache = await cache.restoreCache(cachePaths, cacheKey);
78+
79+
const restoreCache = enableCache
80+
? await cache.restoreCache(cachePaths, cacheKey)
81+
: undefined;
7882

7983
// If unable to restore from the cache, download the binary from GitHub
8084
if (restoreCache === undefined) {
@@ -93,7 +97,9 @@ async function installGitHubReleaseBinary(
9397
{ accept: "application/octet-stream" }
9498
);
9599

96-
await cache.saveCache(cachePaths, cacheKey);
100+
if (enableCache) {
101+
await cache.saveCache(cachePaths, cacheKey);
102+
}
97103
}
98104

99105
// Permissions are an attribute of the filesystem, not the file.
@@ -120,6 +126,7 @@ async function main(): Promise<void> {
120126
const token = unwrap(maybeToken);
121127
const targetBinary = unwrap(maybeTargetBinary);
122128
const homeDirectory = unwrap(maybeHomeDirectory);
129+
const enableCache = core.getInput("cache") === "true";
123130

124131
const storageDirectory = path.join(
125132
homeDirectory,
@@ -132,6 +139,7 @@ async function main(): Promise<void> {
132139
octokit,
133140
targetBinary,
134141
storageDirectory,
142+
enableCache,
135143
token
136144
);
137145
}

0 commit comments

Comments
 (0)