Skip to content

Commit 65de048

Browse files
Merge pull request #13 from WarpBuilds/feat-adds-r2-support
Feat adds r2 support
2 parents 1d2f2a4 + c4d4608 commit 65de048

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/warp-cache/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-actions.warp-cache",
3-
"version": "1.4.1",
3+
"version": "1.4.3",
44
"preview": true,
55
"description": "Github action to use WarpBuild's in-house cache offering",
66
"keywords": [

packages/warp-cache/src/cache.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ export async function restoreCache(
123123
)
124124
core.debug(`Archive Path: ${archivePath}`)
125125

126-
let cacheKey = cacheEntry?.cache_entry?.cache_user_given_key ?? primaryKey
126+
const cacheKey = cacheEntry?.cache_entry?.cache_user_given_key ?? primaryKey
127127

128128
switch (cacheEntry.provider) {
129-
case 's3': {
129+
case 's3':
130+
case 'r2': {
130131
if (!cacheEntry.s3?.pre_signed_url) {
131132
return undefined
132133
}
@@ -138,7 +139,7 @@ export async function restoreCache(
138139

139140
try {
140141
await cacheHttpClient.downloadCache(
141-
cacheEntry.provider,
142+
's3',
142143
cacheEntry.s3?.pre_signed_url,
143144
archivePath
144145
)
@@ -269,7 +270,7 @@ export async function restoreCache(
269270

270271
try {
271272
await cacheHttpClient.downloadCache(
272-
cacheEntry.provider,
273+
'azure_blob',
273274
cacheEntry.azure_blob?.pre_signed_url,
274275
archivePath
275276
)
@@ -413,6 +414,7 @@ export async function saveCache(
413414

414415
switch (reserveCacheResponse.result?.provider) {
415416
case 's3':
417+
case 'r2':
416418
core.debug(`Saving Cache to S3`)
417419
cacheKey = await cacheHttpClient.saveCache(
418420
's3',

packages/warp-cache/src/internal/cacheHttpClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ async function commitCache(
397397
cache_version: cacheVersion,
398398
upload_key: uploadKey,
399399
upload_id: uploadID,
400-
parts: parts,
400+
parts,
401401
vcs_type: 'github',
402402
vcs_repository: getVCSRepository(),
403403
vcs_ref: getVCSRef(),

0 commit comments

Comments
 (0)