Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmuhs committed Dec 6, 2020
1 parent 01ad1fb commit 2c66277
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55111,7 +55111,13 @@ async function restore() {
const paths = [
'.ccache'
];
await cache.restoreCache(paths, key, restoreKeys);
const restoredWith = await cache.restoreCache(paths, key, restoreKeys);
if (restoredWith) {
core.info(`Restored from cache key "${restoredWith}".`);
}
else {
core.info("No cache found.");
}
}
async function configure() {
const ghWorkSpace = external_process_namespaceObject.env.GITHUB_WORKSPACE;
Expand Down
6 changes: 6 additions & 0 deletions dist/save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55072,10 +55072,15 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7799);
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_actions_cache__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1514);
/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_actions_exec__WEBPACK_IMPORTED_MODULE_2__);



async function run() {
try {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info("Ccache stats:");
await _actions_exec__WEBPACK_IMPORTED_MODULE_2__.exec("ccache -s");
let restoreKey = `ccache-`;
let inputKey = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("key");
if (inputKey) {
Expand All @@ -55085,6 +55090,7 @@ async function run() {
const paths = [
'.ccache'
];
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`Save cache using key "${key}".`);
await _actions_cache__WEBPACK_IMPORTED_MODULE_1__.saveCache(paths, key);
}
catch (error) {
Expand Down
8 changes: 7 additions & 1 deletion src/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ async function restore() {
]

const key = restoreKey + "-" + new Date().toISOString();

const paths = [
'.ccache'
]

await cache.restoreCache(paths, key, restoreKeys)
const restoredWith = await cache.restoreCache(paths, key, restoreKeys)
if (restoredWith) {
core.info(`Restored from cache key "${restoredWith}".`);
} else {
core.info("No cache found.");
}
}

async function configure() {
Expand Down
5 changes: 5 additions & 0 deletions src/save.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import * as core from "@actions/core";
import * as cache from "@actions/cache";
import * as exec from "@actions/exec";

async function run() : Promise<void> {
try{
core.info("Ccache stats:")
await exec.exec("ccache -s");

let restoreKey = `ccache-`;
let inputKey = core.getInput("key");

Expand All @@ -15,6 +19,7 @@ async function run() : Promise<void> {
'.ccache'
]

core.info(`Save cache using key "${key}".`)
await cache.saveCache(paths, key);
} catch (error) {
core.setFailed(error.message);
Expand Down

0 comments on commit 2c66277

Please sign in to comment.