Skip to content

Commit

Permalink
fix: 馃悰 action not working in windows or with pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
stormslowly committed Jun 20, 2022
1 parent be2de7b commit cf7040c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ inputs:
install-command:
description: 'Custom install command to use'
required: false
hash-file:
description: 'Path to the file for cypress cache key generation'
required: false
runTests:
description: 'Whether or not to run tests'
required: false
Expand Down
20 changes: 16 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,18 @@ const packageLockFilename = path.join(

const useYarn = () => fs.existsSync(yarnFilename)

const gegUserSpecifiedHashFile = () => {
const userSpecifiedHashFile = core.getInput('lock-hash');
if (userSpecifiedHashFile) {
return path.join(workingDirectory, userSpecifiedHashFile);
}
return useYarn() ? yarnFilename : packageLockFilename;
}

const lockHash = () => {
const lockFilename = useYarn() ? yarnFilename : packageLockFilename
const fileHash = hasha.fromFileSync(lockFilename)
debug(`Hash from file ${lockFilename} is ${fileHash}`)
const hashFile = gegUserSpecifiedHashFile();
const fileHash = hasha.fromFileSync(hashFile);
debug(`Hash from file ${hashFile} is ${fileHash}`)
return fileHash
}

Expand Down Expand Up @@ -635,7 +643,11 @@ const runTests = async () => {
}

// export common environment variables that help run Cypress
core.exportVariable('CYPRESS_CACHE_FOLDER', CYPRESS_CACHE_FOLDER)
if(getInputBool('install', true)) {
// only when cypress is installed by action self, we can export the Cache Folder,
// otherwise use the default one in Cypress
core.exportVariable('CYPRESS_CACHE_FOLDER', CYPRESS_CACHE_FOLDER)
}
core.exportVariable('TERM', 'xterm')

if (customCommand) {
Expand Down

0 comments on commit cf7040c

Please sign in to comment.