From 167f172cbd6ccceff9b69cbeba24f6024a00d556 Mon Sep 17 00:00:00 2001 From: h0x0er Date: Tue, 13 Sep 2022 23:13:41 +0530 Subject: [PATCH] added code to cache cache.txt in post step --- src/cleanup.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cleanup.ts b/src/cleanup.ts index 975e9eb..36ad788 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -3,6 +3,9 @@ import * as cp from "child_process"; import * as core from "@actions/core"; import * as common from "./common"; import isDocker from "is-docker"; +import * as cache from "@actions/cache"; +import { cacheFile, cacheKey } from "./cache"; +import path from "path"; (async () => { if (process.platform !== "linux") { @@ -65,6 +68,12 @@ import isDocker from "is-docker"; }); console.log("Service log:"); console.log(journalLog); + + const cmd = "sudo"; + const args = ["cp", path.join(__dirname, "cache.txt"), cacheFile]; + cp.execFileSync(cmd, args); + const cacheResult = await cache.saveCache([cacheFile], cacheKey); + console.log(cacheResult); } })();