Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 action not working in windows or with pnpm #572

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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