Skip to content
lock

GitHub Action

JavaScript Lockfile Check

v1.2.1 Latest version

JavaScript Lockfile Check

lock

JavaScript Lockfile Check

Check for and enforce the correct lockfile for your JS project

Installation

Copy and paste the following snippet into your .yml file.

              

- name: JavaScript Lockfile Check

uses: ChromaticHQ/[email protected]

Learn more about this action in ChromaticHQ/javascript-lockfile-check-action

Choose a version

JavaScript Lockfile Check

Tests Linting & Checks

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.

Configuration options

  • package-manager (required): The name of the package manager your project uses. Possible values are:
    • npm: Ensure that a package-lock.json file is present and that no yarn.lock file is present.
    • yarn: Ensure that a yarn.lock file is present and that no package-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

Usage

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