This action checks that the correct lockfile is present at the root of a project. It also checks that no extraneous lockfiles for other JavaScript package managers are present. The intent is to enforce a given package manager and avoid a scenario where more than one lockfile is present.
package-manager
(required): The name of the package manager your project uses. Possible values are:npm
: Ensure that apackage-lock.json
file is present and that noyarn.lock
file is present.yarn
: Ensure that ayarn.lock
file is present and that nopackage-lock.json
file is present.
working-directory
(optional): The path to the directory where the lockfile check should occur, relative from the project root. e.g.web/themes/custom/my-custom-theme
To use this action, simply add a step to your workflow, like so:
- uses: ChromaticHQ/[email protected]
with:
package-manager: npm
Here’s an example workflow that checks out your repo and checks that you have the correct lockfile for Yarn within a custom theme for a CMS-based project:
on: push
jobs:
check_js_lockfile:
runs-on: ubuntu-latest
name: Check JS Lockfile
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check JS Lockfile
uses: ChromaticHQ/[email protected]
with:
package-manager: yarn
working-directory: web/themes/custom/my-custom-theme