Unverified Commit b85ac67c authored by Daz DeBoer's avatar Daz DeBoer
Browse files

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.
parent fa0c026e
Loading
Loading
Loading
Loading
+3
Changes for .github/workflows/prod.yml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,9 @@ on:
  push:
  workflow_dispatch:

env:
  CACHE_KEY_SEED: ${{github.workflow}}#${{github.run_number}}-

jobs:
  basic-build:
    strategy:
+2 −1
Changes for src/cache-gradle-user-home.ts: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -28,8 +28,9 @@ export async function restore(): Promise<void> {
        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}|`
+2 −1
Changes for src/cache-project-dot-gradle.ts: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -27,8 +27,9 @@ export async function restore(rootDir: string): Promise<void> {
        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}|`