Skip to content

Commit

Permalink
chore: forbid non-npm lockfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart committed Nov 28, 2022
1 parent a8de3a6 commit 807be0a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/actions/lockfiles/action.yml
@@ -0,0 +1,21 @@
name: 'Lockfile'
description: 'Forbid non-npm lockfiles'
runs:
using: composite
steps:
- name: Check lockfiles
uses: actions/github-script@v6
with:
script: |
const {existsSync} = require('fs');
['yarn.lock', 'pnpm-lock.yaml'].forEach(forbiddenLockFile => {
if(existsSync(forbiddenLockFile)) {
const error = `Lockfile ${forbiddenLockFile} is not allowed in this repo, remove it.`;
core.error(
error,
{title: 'Forbidden lockfile', file: forbiddenLockFile}
);
core.setFailed(error);
}
});
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -15,6 +15,8 @@ jobs:
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- name: Setup
uses: ./.github/actions/setup
- name: Check lockfiles
uses: ./.github/actions/lockfiles
- name: Tests
run: npm test
- name: Build
Expand Down

0 comments on commit 807be0a

Please sign in to comment.