2021-09-14 07:33:50 -04:00
|
|
|
import * as core from '@actions/core'
|
2021-08-20 15:01:43 -04:00
|
|
|
import * as caches from './caches'
|
2020-06-13 07:34:07 -04:00
|
|
|
|
2021-11-15 11:21:55 -05:00
|
|
|
// 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 => handleFailure(e))
|
|
|
|
|
2021-11-28 12:19:56 -05:00
|
|
|
/**
|
|
|
|
* The post-execution entry point for the action, called by Github Actions after completing all steps for the Job.
|
|
|
|
*/
|
2020-06-13 07:54:27 -04:00
|
|
|
export async function run(): Promise<void> {
|
2021-09-14 07:33:50 -04:00
|
|
|
try {
|
|
|
|
await caches.save()
|
|
|
|
} catch (error) {
|
2021-11-15 11:21:55 -05:00
|
|
|
handleFailure(error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleFailure(error: unknown): void {
|
|
|
|
core.warning(`Unhandled error saving cache - job will continue: ${error}`)
|
|
|
|
if (error instanceof Error && error.stack) {
|
|
|
|
core.info(error.stack)
|
2021-09-14 07:33:50 -04:00
|
|
|
}
|
2020-06-13 07:34:07 -04:00
|
|
|
}
|
|
|
|
|
2020-06-13 07:44:30 -04:00
|
|
|
run()
|