2021-09-14 11:33:50 +00:00
|
|
|
import * as core from '@actions/core'
|
2021-08-20 19:01:43 +00:00
|
|
|
import * as caches from './caches'
|
2020-06-13 11:34:07 +00:00
|
|
|
|
2021-11-15 16:21:55 +00: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 17:19:56 +00:00
|
|
|
/**
|
|
|
|
* The post-execution entry point for the action, called by Github Actions after completing all steps for the Job.
|
|
|
|
*/
|
2020-06-13 11:54:27 +00:00
|
|
|
export async function run(): Promise<void> {
|
2021-09-14 11:33:50 +00:00
|
|
|
try {
|
|
|
|
await caches.save()
|
|
|
|
} catch (error) {
|
2021-11-15 16:21:55 +00: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 11:33:50 +00:00
|
|
|
}
|
2020-06-13 11:34:07 +00:00
|
|
|
}
|
|
|
|
|
2020-06-13 11:44:30 +00:00
|
|
|
run()
|