From 6eb7df9157fc2dd6d392d4b1edfbf8c4ef8479d3 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 | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index f2786a0f6..be18a60ab 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 = '_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 b30b503b6..abd752b2e 100644 --- a/src/classes/state/state-cache-storage.ts +++ b/src/classes/state/state-cache-storage.ts @@ -2,12 +2,14 @@ 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 = + '_state' + process.env.GITHUB_WORKFLOW + '-' + process.env.GITHUB_JOB; const STATE_FILE = 'state.txt'; const STALE_DIR = '56acbeaa-1fef-4c79-8f84-7565e560fb03';