From 90b667205be51435793586317467fc72f138f317 Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Fri, 2 Feb 2024 22:15:55 +0100 Subject: [PATCH] github actions cache: Use more unique key --- dist/index.js | 11 ++++++++++- src/classes/state/state-cache-storage.ts | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index f2786a0f..3a1c5002 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1591,11 +1591,12 @@ exports.StateCacheStorage = void 0; const fs_1 = __importDefault(__nccwpck_require__(7147)); const path_1 = __importDefault(__nccwpck_require__(1017)); const os_1 = __importDefault(__nccwpck_require__(2037)); +const process_1 = __importDefault(__nccwpck_require__(7282)); const core = __importStar(__nccwpck_require__(2186)); const github_1 = __nccwpck_require__(5438); const plugin_retry_1 = __nccwpck_require__(6298); const cache = __importStar(__nccwpck_require__(7799)); -const CACHE_KEY = '_state'; +const CACHE_KEY = encodeURIComponent('_state' + process_1.default.env.GITHUB_WORKFLOW + '-' + process_1.default.env.GITHUB_JOB); const STATE_FILE = 'state.txt'; const STALE_DIR = '56acbeaa-1fef-4c79-8f84-7565e560fb03'; const mkTempDir = () => { @@ -89199,6 +89200,14 @@ module.exports = require("perf_hooks"); /***/ }), +/***/ 7282: +/***/ ((module) => { + +"use strict"; +module.exports = require("process"); + +/***/ }), + /***/ 5477: /***/ ((module) => { diff --git a/src/classes/state/state-cache-storage.ts b/src/classes/state/state-cache-storage.ts index b30b503b..b1c3f40a 100644 --- a/src/classes/state/state-cache-storage.ts +++ b/src/classes/state/state-cache-storage.ts @@ -2,12 +2,15 @@ import {IStateStorage} from '../../interfaces/state/state-storage'; import fs from 'fs'; import path from 'path'; import os from 'os'; +import process from 'process'; import * as core from '@actions/core'; import {context, getOctokit} from '@actions/github'; import {retry as octokitRetry} from '@octokit/plugin-retry'; import * as cache from '@actions/cache'; -const CACHE_KEY = '_state'; +const CACHE_KEY = encodeURIComponent( + '_state' + process.env.GITHUB_WORKFLOW + '-' + process.env.GITHUB_JOB +); const STATE_FILE = 'state.txt'; const STALE_DIR = '56acbeaa-1fef-4c79-8f84-7565e560fb03';