mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-26 03:06:19 +08:00
322805e800
This is a pure refactor, moving from a separate .cache file per bundle to a single cache-metadata.json file describing all bundles. Instead of storing cache metadata in a separate .cache file per artifact bundle, all of the metadata is now stored in a single `.json` file. This will make it easier to implement more flexible artifact-caching strategies, such as caching each wrapper zip separately. * Always include cache protocol version in cache key * Store all cache metadata in a single JSON file * Rename cache-metadata file and bump protocol version * Polish and documentation
28 lines
896 B
TypeScript
28 lines
896 B
TypeScript
import * as core from '@actions/core'
|
|
import * as caches from './caches'
|
|
|
|
// 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.
|
|
*/
|
|
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)
|
|
}
|
|
}
|
|
|
|
run()
|