Skip to content

Commit 86c14b1

Browse files
committed
Fix cache paths
1 parent 9a66b7e commit 86c14b1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

gc.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ const core = require('@actions/core')
55

66
function init(cacheConfig) {
77
core.startGroup(`Computing initial ${cacheConfig.name} cache hash`)
8-
fs.writeFileSync(cacheConfig.path + '.sha256', computeCacheHash(cacheConfig.path))
8+
fs.writeFileSync(cacheConfig.paths[0] + '.sha256', computeCacheHash(cacheConfig.paths[0]))
99
core.endGroup()
1010
}
1111

1212
function run(cacheConfig) {
13-
if (!fs.existsSync(cacheConfig.path)) {
13+
if (!fs.existsSync(cacheConfig.paths[0])) {
1414
core.warning(`No ${cacheConfig.name} cache present`)
1515
return
1616
}
1717

18-
const files = fs.readdirSync(cacheConfig.path, { withFileTypes: true, recursive: true })
18+
const files = fs.readdirSync(cacheConfig.paths[0], { withFileTypes: true, recursive: true })
1919
.filter(d => d.isFile())
2020
.map(d => {
2121
const file = path.join(d.path, d.name)
@@ -44,18 +44,18 @@ function run(cacheConfig) {
4444

4545
function cacheChanged(cacheConfig) {
4646
core.startGroup(`Checking ${cacheConfig.name} cache for changes`)
47-
const hash = computeCacheHash(cacheConfig.path)
48-
const changed = fs.readFileSync(cacheConfig.path + '.sha256') != hash
47+
const hash = computeCacheHash(cacheConfig.paths[0])
48+
const changed = fs.readFileSync(cacheConfig.paths[0] + '.sha256') != hash
4949
core.info(`Cache has changes: ${changed}`)
5050
core.endGroup()
5151
return changed ? hash : undefined
5252
}
5353

54-
function computeCacheHash(path) {
54+
function computeCacheHash(cachePath) {
5555
let hash = crypto.createHash('sha256')
5656

57-
if (fs.existsSync(path)) {
58-
const files = fs.readdirSync(path, { withFileTypes: true, recursive: true })
57+
if (fs.existsSync(cachePath)) {
58+
const files = fs.readdirSync(cachePath, { withFileTypes: true, recursive: true })
5959
.filter(d => d.isFile())
6060
.map(d => d.path)
6161
.sort()

post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async function saveGcCache(cacheConfig) {
7272

7373
// cache is unchanged
7474
if (!hash) {
75-
core.info(`No changes to ${cacheConfig} cache detected, skipping upload`)
75+
core.info(`No changes to ${cacheConfig.name} cache detected, skipping upload`)
7676
return
7777
}
7878

0 commit comments

Comments
 (0)