Skip to content

Commit dffc020

Browse files
-.-
1 parent c3abd17 commit dffc020

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

dist/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,7 @@ try {
334334
const lockPath = core.getInput('packageLockJSON')
335335
const jsonPackageFile = JSON.parse(fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, packagePath || 'package.json')))
336336
const regexp = new RegExp(`"name":"${jsonPackageFile.name}","version":".*?",`, 'g')
337-
const jsonLockFile = JSON.parse(fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, lockPath || 'package-lock.json')))
338-
.toString()
339-
.replace(/\n|\s|\r|\t/g, '')
340-
.replace(regexp, '')
337+
const jsonLockFile = fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, lockPath || 'package-lock.json')).toString(('utf-8')).replace(/\n|\s|\r|\t/g, '').replace(regexp, '')
341338

342339
core.setOutput('cacheKey', crypto.createHash('sha256').update(jsonLockFile, 'utf8').digest('hex'));
343340
} catch (error) {

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ try {
88
const lockPath = core.getInput('packageLockJSON')
99
const jsonPackageFile = JSON.parse(fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, packagePath || 'package.json')))
1010
const regexp = new RegExp(`"name":"${jsonPackageFile.name}","version":".*?",`, 'g')
11-
const jsonLockFile = fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, lockPath || 'package-lock.json')).replace(/\n|\s|\r|\t/g, '').replace(regexp, '')
11+
const jsonLockFile = fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, lockPath || 'package-lock.json')).toString(('utf-8')).replace(/\n|\s|\r|\t/g, '').replace(regexp, '')
1212

1313
core.setOutput('cacheKey', crypto.createHash('sha256').update(jsonLockFile, 'utf8').digest('hex'));
1414
} catch (error) {

0 commit comments

Comments
 (0)