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