Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crashing if cache upload fails #471

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ const exec_1 = __nccwpck_require__(1514);
const fs_1 = __nccwpck_require__(7147);
const os_1 = __nccwpck_require__(2037);
const path_1 = __nccwpck_require__(1017);
// Catch and log any unhandled exceptions. These exceptions can leak out of the
// uploadChunk method in @actions/toolkit when a failed upload closes the file
// descriptor causing any in-process reads to throw an uncaught exception.
// Instead of failing this action, just warn.
process.on('uncaughtException', (e) => {
(0, core_1.info)(`[warning]${e.message}`);
});
const restoreCaches = () => __awaiter(void 0, void 0, void 0, function* () {
const cacheHits = { iso: true, kic: true, preload: true };
if (!useCache()) {
Expand Down
10 changes: 9 additions & 1 deletion src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ import {
restoreCache as restoreCacheAction,
saveCache as saveCacheAction,
} from '@actions/cache'
import {getInput as getInputAction} from '@actions/core'
import {info, getInput as getInputAction} from '@actions/core'
import {exec} from '@actions/exec'
import {existsSync} from 'fs'
import {arch, homedir} from 'os'
import {join} from 'path'

// Catch and log any unhandled exceptions. These exceptions can leak out of the
// uploadChunk method in @actions/toolkit when a failed upload closes the file
// descriptor causing any in-process reads to throw an uncaught exception.
// Instead of failing this action, just warn.
process.on('uncaughtException', (e) => {
info(`[warning]${e.message}`)
})

type CacheHits = {
iso: boolean
kic: boolean
Expand Down
Loading