mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-11-08 21:49:00 +08:00
Normalize paths to Gradle User Home when calculating cache keys
Fixes #77
This commit is contained in:
@@ -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[]
|
||||
|
||||
Reference in New Issue
Block a user