Skip to content

Commit

Permalink
feat(lib-license-checker): support npm and yarn cache, support exclud…
Browse files Browse the repository at this point in the history
…ing packages (#24)

Signed-off-by: Dirk de Visser <[email protected]>
  • Loading branch information
dirkdev98 authored Mar 8, 2024
1 parent 2c54a9a commit 8146232
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/lib-license-checker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
on:
workflow_call:
inputs:
exclude-packages:
description: "Semicolon separated list of dependencies to skip."
type: string
default: ""

jobs:
check-license:
Expand All @@ -13,10 +18,33 @@ jobs:
persist-credentials: false

- uses: actions/setup-node@v4
if: ${{ hashFiles('yarn.lock') != '' }}
with:
node-version: 20
cache: "yarn"

- name: "Check"
- uses: actions/setup-node@v4
if: ${{ hashFiles('package-lock.json') != '' }}
with:
node-version: 20
cache: "npm"

- uses: actions/setup-node@v4
if: ${{ hashFiles('yarn.lock') == '' && hashFiles('package-lock.json') == '' }}
with:
node-version: 20

- name: "Install Yarn"
if: ${{ hashFiles('yarn.lock') != '' }}
run: |
yarn
# Default to NPM if another unsupported package manager is used.
- name: "Install NPM"
if: ${{ hashFiles('yarn.lock') == '' }}
run: |
npm install --ignore-scripts
- name: "Check licenses"
run: |
npm install
npx license-checker --production --excludePrivatePackages --summary --onlyAllow="MIT;ISC;Apache-2.0;BSD-2-Clause;BSD-3-Clause;Python-2.0;0BSD;BlueOak-1.0.0;LGPL-3.0-or-later;Custom: https://lightbase.nl;Unlicense;CC-BY-4.0;CC-BY-3.0"
npx license-checker -- --production --excludePackages=${{ inputs.exclude-packages }} --excludePrivatePackages --summary --onlyAllow="MIT;ISC;Apache-2.0;BSD-2-Clause;BSD-3-Clause;Python-2.0;0BSD;BlueOak-1.0.0;LGPL-3.0-or-later;Custom: https://lightbase.nl;Unlicense;CC-BY-4.0;CC-BY-3.0"

0 comments on commit 8146232

Please sign in to comment.