Normalize paths to Gradle User Home when calculating cache keys

Fixes #77
This commit is contained in:
Daz DeBoer 2021-09-27 21:05:17 -06:00
parent cc5cdb7fe0
commit 5a5a5b4387
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
3 changed files with 21 additions and 6 deletions

View file

@ -2,6 +2,7 @@ import * as core from '@actions/core'
import * as cache from '@actions/cache'
import * as github from '@actions/github'
import * as crypto from 'crypto'
import * as path from 'path'
export function isCacheDisabled(): boolean {
return core.getBooleanInput('cache-disabled')
@ -53,6 +54,12 @@ export function hashStrings(values: string[]): string {
return hash.digest('hex')
}
export function hashFileNames(fileNames: string[]): string {
return hashStrings(
fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/'))
)
}
class CacheKey {
key: string
restoreKeys: string[]