Skip to content

Commit

Permalink
Fix DFX cache path.
Browse files Browse the repository at this point in the history
  • Loading branch information
q-uint committed Apr 30, 2024
1 parent 1e3b30a commit 2c572d7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/cache-save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79477,6 +79477,7 @@ const core_1 = __nccwpck_require__(2186);
const os_1 = __nccwpck_require__(2037);
const fs_1 = __nccwpck_require__(7147);
const glob_1 = __nccwpck_require__(8090);
const child_process_1 = __nccwpck_require__(2081);
function resolveDFXVersion() {
const dfxVersion = (0, core_1.getInput)('dfx-version');
const dfxFilePath = (0, core_1.getInput)('dfx-version-file');
Expand All @@ -79501,7 +79502,7 @@ exports.resolveDFXVersion = resolveDFXVersion;
function getCachePaths() {
let cachePaths = [];
if ((0, core_1.getInput)("dfx-version") || (0, core_1.getInput)("dfx-version-file")) {
cachePaths.push(`${process.env.GITHUB_WORKSPACE}/.cache/dfinity`);
cachePaths.push((0, child_process_1.execSync)("dfx cache show").toString().trim());
cachePaths.push(`${process.env.GITHUB_WORKSPACE}/.dfx`);
}
if ((0, core_1.getInput)("vessel-version")) {
Expand Down Expand Up @@ -79612,7 +79613,7 @@ const cacheDFX = () => __awaiter(void 0, void 0, void 0, function* () {
logWarning(`Some cache paths do not exist: ${nonExistendPaths.join(', ')}`);
}
if (primaryKey === state) {
core.info(`Cache key is the same as the previous run. Skipping cache save.`);
core.info(`Cache key (${primaryKey}) is the same as the previous run. Skipping cache save.`);
return;
}
const cacheID = yield cache.saveCache(cachePaths, primaryKey);
Expand Down
3 changes: 2 additions & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82756,6 +82756,7 @@ const core_1 = __nccwpck_require__(2186);
const os_1 = __nccwpck_require__(2037);
const fs_1 = __nccwpck_require__(7147);
const glob_1 = __nccwpck_require__(8090);
const child_process_1 = __nccwpck_require__(2081);
function resolveDFXVersion() {
const dfxVersion = (0, core_1.getInput)('dfx-version');
const dfxFilePath = (0, core_1.getInput)('dfx-version-file');
Expand All @@ -82780,7 +82781,7 @@ exports.resolveDFXVersion = resolveDFXVersion;
function getCachePaths() {
let cachePaths = [];
if ((0, core_1.getInput)("dfx-version") || (0, core_1.getInput)("dfx-version-file")) {
cachePaths.push(`${process.env.GITHUB_WORKSPACE}/.cache/dfinity`);
cachePaths.push((0, child_process_1.execSync)("dfx cache show").toString().trim());
cachePaths.push(`${process.env.GITHUB_WORKSPACE}/.dfx`);
}
if ((0, core_1.getInput)("vessel-version")) {
Expand Down
3 changes: 2 additions & 1 deletion src/cache-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {getInput, warning} from '@actions/core';
import { platform } from 'os';
import { existsSync, readFileSync } from 'fs';
import { hashFiles } from '@actions/glob';
import { execSync } from 'child_process';

export function resolveDFXVersion(): string | undefined {
const dfxVersion = getInput('dfx-version');
Expand Down Expand Up @@ -32,7 +33,7 @@ export function resolveDFXVersion(): string | undefined {
export function getCachePaths(): string[] {
let cachePaths: string[] = [];
if (getInput("dfx-version") || getInput("dfx-version-file")) {
cachePaths.push(`${process.env.HOME}/.cache/dfinity`);
cachePaths.push(execSync("dfx cache show").toString().trim());
cachePaths.push(`${process.env.GITHUB_WORKSPACE}/.dfx`);
}
if (getInput("vessel-version")) {
Expand Down
2 changes: 1 addition & 1 deletion src/cache-save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const cacheDFX = async () => {
}

if (primaryKey === state) {
core.info(`Cache key is the same as the previous run. Skipping cache save.`);
core.info(`Cache key (${primaryKey}) is the same as the previous run. Skipping cache save.`);
return;
}

Expand Down

0 comments on commit 2c572d7

Please sign in to comment.