mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-25 01:46:18 +08:00
Seed the cache key with workflow id in CI
This will eliminate cache entries from previous workflow runs, allowing us to test cache functionality in isolation. If the `CACHE_KEY_SEED` environment variable is not set, this will have no impact.
This commit is contained in:
parent
fa0c026e07
commit
b85ac67c9a
3
.github/workflows/prod.yml
vendored
3
.github/workflows/prod.yml
vendored
@ -6,6 +6,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CACHE_KEY_SEED: ${{github.workflow}}#${{github.run_number}}-
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
basic-build:
|
basic-build:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -28,8 +28,9 @@ export async function restore(): Promise<void> {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cacheKeySeed = process.env[`CACHE_KEY_SEED`] || ''
|
||||||
const runnerOs = process.env[`RUNNER_OS`] || ''
|
const runnerOs = process.env[`RUNNER_OS`] || ''
|
||||||
const cacheKeyPrefix = `${runnerOs}-gradle|`
|
const cacheKeyPrefix = `${cacheKeySeed}${runnerOs}|gradle|`
|
||||||
|
|
||||||
const args = truncateArgs(core.getInput('arguments'))
|
const args = truncateArgs(core.getInput('arguments'))
|
||||||
const cacheKeyWithArgs = `${cacheKeyPrefix}${args}|`
|
const cacheKeyWithArgs = `${cacheKeyPrefix}${args}|`
|
||||||
|
@ -27,8 +27,9 @@ export async function restore(rootDir: string): Promise<void> {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cacheKeySeed = process.env[`CACHE_KEY_SEED`] || ''
|
||||||
const runnerOs = process.env[`RUNNER_OS`] || ''
|
const runnerOs = process.env[`RUNNER_OS`] || ''
|
||||||
const cacheKeyPrefix = `${runnerOs}-project|`
|
const cacheKeyPrefix = `${cacheKeySeed}${runnerOs}|project|`
|
||||||
|
|
||||||
const args = truncateArgs(core.getInput('arguments'))
|
const args = truncateArgs(core.getInput('arguments'))
|
||||||
const cacheKeyWithArgs = `${cacheKeyPrefix}${args}|`
|
const cacheKeyWithArgs = `${cacheKeyPrefix}${args}|`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user