mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-29 18:00:59 -05:00
Fix resource URLs
This commit is contained in:
parent
577b274c51
commit
b25804d19e
3 changed files with 6 additions and 9 deletions
5
dist/restore/index.js
vendored
5
dist/restore/index.js
vendored
|
@ -1605,7 +1605,6 @@ function uploadChunk(restClient, resourceUrl, data, start, end) {
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
"Content-Range": getContentRange(start, end)
|
"Content-Range": getContentRange(start, end)
|
||||||
};
|
};
|
||||||
core.debug(`Resource URL: ${resourceUrl}`);
|
|
||||||
return yield restClient.uploadStream("PATCH", resourceUrl, data, requestOptions);
|
return yield restClient.uploadStream("PATCH", resourceUrl, data, requestOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1613,7 +1612,7 @@ function commitCache(restClient, cacheId, filesize) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const requestOptions = getRequestOptions();
|
const requestOptions = getRequestOptions();
|
||||||
const commitCacheRequest = { size: filesize };
|
const commitCacheRequest = { size: filesize };
|
||||||
return yield restClient.create(cacheId.toString(), commitCacheRequest, requestOptions);
|
return yield restClient.create(`caches/${cacheId.toString()}`, commitCacheRequest, requestOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function saveCache(cacheId, archivePath) {
|
function saveCache(cacheId, archivePath) {
|
||||||
|
@ -1622,7 +1621,7 @@ function saveCache(cacheId, archivePath) {
|
||||||
core.debug("Uploading chunks");
|
core.debug("Uploading chunks");
|
||||||
// Upload Chunks
|
// Upload Chunks
|
||||||
const fileSize = fs.statSync(archivePath).size;
|
const fileSize = fs.statSync(archivePath).size;
|
||||||
const resourceUrl = getCacheApiUrl() + cacheId.toString();
|
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
||||||
const uploads = [];
|
const uploads = [];
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
while (offset < fileSize) {
|
while (offset < fileSize) {
|
||||||
|
|
5
dist/save/index.js
vendored
5
dist/save/index.js
vendored
|
@ -1605,7 +1605,6 @@ function uploadChunk(restClient, resourceUrl, data, start, end) {
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
"Content-Range": getContentRange(start, end)
|
"Content-Range": getContentRange(start, end)
|
||||||
};
|
};
|
||||||
core.debug(`Resource URL: ${resourceUrl}`);
|
|
||||||
return yield restClient.uploadStream("PATCH", resourceUrl, data, requestOptions);
|
return yield restClient.uploadStream("PATCH", resourceUrl, data, requestOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1613,7 +1612,7 @@ function commitCache(restClient, cacheId, filesize) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const requestOptions = getRequestOptions();
|
const requestOptions = getRequestOptions();
|
||||||
const commitCacheRequest = { size: filesize };
|
const commitCacheRequest = { size: filesize };
|
||||||
return yield restClient.create(cacheId.toString(), commitCacheRequest, requestOptions);
|
return yield restClient.create(`caches/${cacheId.toString()}`, commitCacheRequest, requestOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function saveCache(cacheId, archivePath) {
|
function saveCache(cacheId, archivePath) {
|
||||||
|
@ -1622,7 +1621,7 @@ function saveCache(cacheId, archivePath) {
|
||||||
core.debug("Uploading chunks");
|
core.debug("Uploading chunks");
|
||||||
// Upload Chunks
|
// Upload Chunks
|
||||||
const fileSize = fs.statSync(archivePath).size;
|
const fileSize = fs.statSync(archivePath).size;
|
||||||
const resourceUrl = getCacheApiUrl() + cacheId.toString();
|
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
||||||
const uploads = [];
|
const uploads = [];
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
while (offset < fileSize) {
|
while (offset < fileSize) {
|
||||||
|
|
|
@ -157,7 +157,6 @@ async function uploadChunk(
|
||||||
"Content-Range": getContentRange(start, end)
|
"Content-Range": getContentRange(start, end)
|
||||||
};
|
};
|
||||||
|
|
||||||
core.debug(`Resource URL: ${resourceUrl}`);
|
|
||||||
return await restClient.uploadStream<void>("PATCH", resourceUrl, data, requestOptions);
|
return await restClient.uploadStream<void>("PATCH", resourceUrl, data, requestOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +168,7 @@ async function commitCache(
|
||||||
const requestOptions = getRequestOptions();
|
const requestOptions = getRequestOptions();
|
||||||
const commitCacheRequest: CommitCacheRequest = { size: filesize };
|
const commitCacheRequest: CommitCacheRequest = { size: filesize };
|
||||||
return await restClient.create(
|
return await restClient.create(
|
||||||
cacheId.toString(),
|
`caches/${cacheId.toString()}`,
|
||||||
commitCacheRequest,
|
commitCacheRequest,
|
||||||
requestOptions
|
requestOptions
|
||||||
);
|
);
|
||||||
|
@ -184,7 +183,7 @@ export async function saveCache(
|
||||||
core.debug("Uploading chunks");
|
core.debug("Uploading chunks");
|
||||||
// Upload Chunks
|
// Upload Chunks
|
||||||
const fileSize = fs.statSync(archivePath).size;
|
const fileSize = fs.statSync(archivePath).size;
|
||||||
const resourceUrl = getCacheApiUrl() + cacheId.toString();
|
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
||||||
const uploads: Promise<IRestResponse<void>>[] = [];
|
const uploads: Promise<IRestResponse<void>>[] = [];
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
while (offset < fileSize) {
|
while (offset < fileSize) {
|
||||||
|
|
Loading…
Reference in a new issue