From d36a3314a51c2a67e0e4058eb459dd6ece9b60f0 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Fri, 25 Jun 2021 12:06:49 +0300 Subject: [PATCH] work on resolving comments --- .github/workflows/e2e-cache.yml | 4 ++-- .github/workflows/versions.yml | 2 +- README.md | 2 +- __tests__/cache-restore.test.ts | 2 +- action.yml | 2 +- dist/cache-save/index.js | 2 +- dist/setup/index.js | 2 +- src/cache-restore.ts | 2 +- src/cache-save.ts | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 0a801b78..e7003319 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -3,8 +3,8 @@ name: e2e-cache on: pull_request: paths-ignore: - - '**.md' - push: + - '**.md' + push: branches: - main - releases/* diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index 7d79b9e8..b459c8aa 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -6,7 +6,7 @@ on: - '**.md' push: branches: - - main + - main - releases/* paths-ignore: - '**.md' diff --git a/README.md b/README.md index 8458eeaf..b31ebdf5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ build-test status versions status proxy status

-This action provides the following functionality for GitHub Actions runners: +This action provides the following functionality for GitHub Actions users: - Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH - Optionally caching npm/yarn dependencies diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts index 105991fb..18962e57 100644 --- a/__tests__/cache-restore.test.ts +++ b/__tests__/cache-restore.test.ts @@ -126,7 +126,7 @@ describe('cache-restore', () => { await restoreCache(packageManager); expect(hashFilesSpy).toHaveBeenCalled(); expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: ${platform}-${packageManager}-${fileHash}` + `Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}` ); expect(infoSpy).not.toHaveBeenCalledWith( `${packageManager} cache is not found` diff --git a/action.yml b/action.yml index 7be39f1e..213dc9d2 100644 --- a/action.yml +++ b/action.yml @@ -20,7 +20,7 @@ inputs: description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. default: ${{ github.token }} cache: - description: 'Used to specify package manager for caching in default directory. Supported values: npm, yarn' + description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn' # TODO: add input to control forcing to pull from cloud or dist. # escape valve for someone having issues or needing the absolute latest which isn't cached yet # Deprecated option, do not use. Will not be supported after October 1, 2019 diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 86263466..d4ce3f4e 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -50583,8 +50583,8 @@ const constants_1 = __webpack_require__(196); const cache_utils_1 = __webpack_require__(452); function run() { return __awaiter(this, void 0, void 0, function* () { - const cacheLock = core.getInput('cache'); try { + const cacheLock = core.getInput('cache'); yield cachePackages(cacheLock); } catch (error) { diff --git a/dist/setup/index.js b/dist/setup/index.js index 77cda705..af8a5adf 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -42732,7 +42732,7 @@ exports.restoreCache = (packageManager) => __awaiter(void 0, void 0, void 0, fun const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager); const lockFilePath = findLockFile(packageManagerInfo); const fileHash = yield glob.hashFiles(lockFilePath); - const primaryKey = `${platform}-${packageManager}-${fileHash}`; + const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`; core.debug(`primary key is ${primaryKey}`); core.saveState(constants_1.State.CachePrimaryKey, primaryKey); const cacheKey = yield cache.restoreCache([cachePath], primaryKey); diff --git a/src/cache-restore.ts b/src/cache-restore.ts index 3784a202..a9100252 100644 --- a/src/cache-restore.ts +++ b/src/cache-restore.ts @@ -25,7 +25,7 @@ export const restoreCache = async (packageManager: string) => { const lockFilePath = findLockFile(packageManagerInfo); const fileHash = await glob.hashFiles(lockFilePath); - const primaryKey = `${platform}-${packageManager}-${fileHash}`; + const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`; core.debug(`primary key is ${primaryKey}`); core.saveState(State.CachePrimaryKey, primaryKey); diff --git a/src/cache-save.ts b/src/cache-save.ts index 01645fc7..11f830b8 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -4,8 +4,8 @@ import {State} from './constants'; import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils'; export async function run() { - const cacheLock = core.getInput('cache'); try { + const cacheLock = core.getInput('cache'); await cachePackages(cacheLock); } catch (error) { core.setFailed(error.message);