gradle-build-action/src/post.ts

28 lines
925 B
TypeScript
Raw Permalink Normal View History

import * as core from '@actions/core'
import * as setupGradle from './setup-gradle'
2020-06-13 11:34:07 +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))
/**
* 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> {
try {
await setupGradle.complete()
} catch (error) {
handleFailure(error)
}
}
function handleFailure(error: unknown): void {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`)
if (error instanceof Error && error.stack) {
core.info(error.stack)
}
2020-06-13 11:34:07 +00:00
}
2020-06-13 11:44:30 +00:00
run()