File tree 2 files changed +26
-4
lines changed
2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -74454,20 +74454,31 @@ const packageLockFilename = path.join(
74454
74454
)
74455
74455
74456
74456
const useYarn = () => fs.existsSync(yarnFilename)
74457
-
74458
74457
const usePnpm = () => fs.existsSync(pnpmLockFilename)
74458
+ const useNpm = () => fs.existsSync(packageLockFilename)
74459
74459
74460
74460
const lockHash = () => {
74461
74461
const lockFilename = useYarn()
74462
74462
? yarnFilename
74463
74463
: usePnpm()
74464
74464
? pnpmLockFilename
74465
- : packageLockFilename
74465
+ : useNpm()
74466
+ ? packageLockFilename
74467
+ : noLockFile()
74466
74468
const fileHash = hasha.fromFileSync(lockFilename)
74467
74469
debug(`Hash from file ${lockFilename} is ${fileHash}`)
74468
74470
return fileHash
74469
74471
}
74470
74472
74473
+ const noLockFile = () => {
74474
+ core.error(
74475
+ `Action failed. Missing package manager lockfile. ` +
74476
+ `Expecting one of package-lock.json (npm), pnpm-lock.yaml (pnpm) or yarn.lock (yarn) in working-directory ` +
74477
+ workingDirectory
74478
+ )
74479
+ process.exit(1)
74480
+ }
74481
+
74471
74482
// enforce the same NPM cache folder across different operating systems
74472
74483
const NPM_CACHE_FOLDER = path.join(homeDirectory, '.npm')
74473
74484
const getNpmCache = () => {
Original file line number Diff line number Diff line change @@ -103,20 +103,31 @@ const packageLockFilename = path.join(
103
103
)
104
104
105
105
const useYarn = ( ) => fs . existsSync ( yarnFilename )
106
-
107
106
const usePnpm = ( ) => fs . existsSync ( pnpmLockFilename )
107
+ const useNpm = ( ) => fs . existsSync ( packageLockFilename )
108
108
109
109
const lockHash = ( ) => {
110
110
const lockFilename = useYarn ( )
111
111
? yarnFilename
112
112
: usePnpm ( )
113
113
? pnpmLockFilename
114
- : packageLockFilename
114
+ : useNpm ( )
115
+ ? packageLockFilename
116
+ : noLockFile ( )
115
117
const fileHash = hasha . fromFileSync ( lockFilename )
116
118
debug ( `Hash from file ${ lockFilename } is ${ fileHash } ` )
117
119
return fileHash
118
120
}
119
121
122
+ const noLockFile = ( ) => {
123
+ core . error (
124
+ `Action failed. Missing package manager lockfile. ` +
125
+ `Expecting one of package-lock.json (npm), pnpm-lock.yaml (pnpm) or yarn.lock (yarn) in working-directory ` +
126
+ workingDirectory
127
+ )
128
+ process . exit ( 1 )
129
+ }
130
+
120
131
// enforce the same NPM cache folder across different operating systems
121
132
const NPM_CACHE_FOLDER = path . join ( homeDirectory , '.npm' )
122
133
const getNpmCache = ( ) => {
You can’t perform that action at this time.
0 commit comments