gradle-build-action/src/post.ts

26 lines
802 B
TypeScript
Raw Normal View History

import * as core from '@actions/core'
import * as caches from './caches'
2020-06-13 07:34:07 -04: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))
2020-06-13 07:34:07 -04:00
// Invoked by GitHub Actions
2020-06-13 07:54:27 -04:00
export async function run(): Promise<void> {
try {
await caches.save()
} catch (error) {
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)
}
2020-06-13 07:34:07 -04:00
}
2020-06-13 07:44:30 -04:00
run()