Include workflow name in cache key

Fixes #699 by avoiding cache key collisions between jobs with the
same name in different workflows.
This commit is contained in:
daz 2023-05-23 14:38:34 -06:00
parent 631021bf98
commit 2bf6bc3646
No known key found for this signature in database
5 changed files with 8 additions and 8 deletions

4
dist/main/index.js vendored
View File

@ -64395,7 +64395,7 @@ const exec = __importStar(__nccwpck_require__(1514));
const crypto = __importStar(__nccwpck_require__(6113)); const crypto = __importStar(__nccwpck_require__(6113));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
const CACHE_PROTOCOL_VERSION = 'v7-'; const CACHE_PROTOCOL_VERSION = 'v8-';
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'; const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
const CACHE_DISABLED_PARAMETER = 'cache-disabled'; const CACHE_DISABLED_PARAMETER = 'cache-disabled';
const CACHE_READONLY_PARAMETER = 'cache-read-only'; const CACHE_READONLY_PARAMETER = 'cache-read-only';
@ -64461,7 +64461,7 @@ function getCacheKeyEnvironment() {
return process.env[CACHE_KEY_OS_VAR] || runnerOs; return process.env[CACHE_KEY_OS_VAR] || runnerOs;
} }
function getCacheKeyJob() { function getCacheKeyJob() {
return process.env[CACHE_KEY_JOB_VAR] || github.context.job; return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`;
} }
function getCacheKeyJobInstance() { function getCacheKeyJobInstance() {
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR]; const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];

File diff suppressed because one or more lines are too long

4
dist/post/index.js vendored
View File

@ -63498,7 +63498,7 @@ const exec = __importStar(__nccwpck_require__(1514));
const crypto = __importStar(__nccwpck_require__(6113)); const crypto = __importStar(__nccwpck_require__(6113));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
const CACHE_PROTOCOL_VERSION = 'v7-'; const CACHE_PROTOCOL_VERSION = 'v8-';
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'; const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
const CACHE_DISABLED_PARAMETER = 'cache-disabled'; const CACHE_DISABLED_PARAMETER = 'cache-disabled';
const CACHE_READONLY_PARAMETER = 'cache-read-only'; const CACHE_READONLY_PARAMETER = 'cache-read-only';
@ -63564,7 +63564,7 @@ function getCacheKeyEnvironment() {
return process.env[CACHE_KEY_OS_VAR] || runnerOs; return process.env[CACHE_KEY_OS_VAR] || runnerOs;
} }
function getCacheKeyJob() { function getCacheKeyJob() {
return process.env[CACHE_KEY_JOB_VAR] || github.context.job; return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`;
} }
function getCacheKeyJobInstance() { function getCacheKeyJobInstance() {
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR]; const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ import * as fs from 'fs'
import {CacheEntryListener} from './cache-reporting' import {CacheEntryListener} from './cache-reporting'
const CACHE_PROTOCOL_VERSION = 'v7-' const CACHE_PROTOCOL_VERSION = 'v8-'
const JOB_CONTEXT_PARAMETER = 'workflow-job-context' const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
const CACHE_DISABLED_PARAMETER = 'cache-disabled' const CACHE_DISABLED_PARAMETER = 'cache-disabled'
@ -115,7 +115,7 @@ function getCacheKeyEnvironment(): string {
} }
function getCacheKeyJob(): string { function getCacheKeyJob(): string {
return process.env[CACHE_KEY_JOB_VAR] || github.context.job return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`
} }
function getCacheKeyJobInstance(): string { function getCacheKeyJobInstance(): string {