diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 963130e..235a88c 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -6,6 +6,9 @@ on: push: workflow_dispatch: +env: + CACHE_KEY_SEED: ${{github.workflow}}#${{github.run_number}}- + jobs: basic-build: strategy: diff --git a/src/cache-gradle-user-home.ts b/src/cache-gradle-user-home.ts index b69a5dc..cf21b9f 100644 --- a/src/cache-gradle-user-home.ts +++ b/src/cache-gradle-user-home.ts @@ -28,8 +28,9 @@ export async function restore(): Promise { return } + const cacheKeySeed = process.env[`CACHE_KEY_SEED`] || '' const runnerOs = process.env[`RUNNER_OS`] || '' - const cacheKeyPrefix = `${runnerOs}-gradle|` + const cacheKeyPrefix = `${cacheKeySeed}${runnerOs}|gradle|` const args = truncateArgs(core.getInput('arguments')) const cacheKeyWithArgs = `${cacheKeyPrefix}${args}|` diff --git a/src/cache-project-dot-gradle.ts b/src/cache-project-dot-gradle.ts index 7aa3197..732d92f 100644 --- a/src/cache-project-dot-gradle.ts +++ b/src/cache-project-dot-gradle.ts @@ -27,8 +27,9 @@ export async function restore(rootDir: string): Promise { return } + const cacheKeySeed = process.env[`CACHE_KEY_SEED`] || '' const runnerOs = process.env[`RUNNER_OS`] || '' - const cacheKeyPrefix = `${runnerOs}-project|` + const cacheKeyPrefix = `${cacheKeySeed}${runnerOs}|project|` const args = truncateArgs(core.getInput('arguments')) const cacheKeyWithArgs = `${cacheKeyPrefix}${args}|`