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

feat: user-friendly error if lock file missing #848

Merged

Conversation

MikeMcC399
Copy link
Collaborator

@MikeMcC399 MikeMcC399 commented Mar 23, 2023

This PR catches the error condition of a missing package manager lock file and displays a user-friendly error message.

The action requires a lock file from npm, pnpm or yarn in order to install dependencies and store the cache.


BEFORE

The action fails showing an error message similar to the following:

@cypress/github-action trying to restore cached NPM modules
node:internal/fs/utils:345
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/runner/work/github-action/github-action/examples/yarn-classic/package-lock.json'

This error message only mentions package-lock.json (npm). It does not mention lock file names from pnpm or yarn, which are also supported.


AFTER

An error message is shown in the action logs summary and action logs details similar to the following. This makes the error condition clearer and provides the hints necessary to remediate the error.

"Action failed. Missing package manager lockfile. Expecting one of package-lock.json (npm), pnpm-lock.yaml (pnpm) or yarn.lock (yarn) in working-directory /home/runner/work/github-action/github-action/examples/yarn-classic"

Summary

yarn-no-lock-summary

Detail

yarn-no-lock-detail

@MikeMcC399 MikeMcC399 marked this pull request as ready for review March 23, 2023 12:16
index.js Show resolved Hide resolved
@lmiller1990 lmiller1990 self-requested a review March 26, 2023 22:59
@lmiller1990
Copy link
Contributor

@AtofStryker can I get a quick 👀 , thanks!

dist/index.js Show resolved Hide resolved
@AtofStryker AtofStryker merged commit 91a7479 into cypress-io:master Mar 28, 2023
@github-actions
Copy link

🎉 This PR is included in version 5.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants