-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 1.75 KB
/
nodejs-license.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Node license check
on: pull_request
env:
ALLOWED_LICENSES: >
MIT;
0BSD;
BSD-2-Clause;
BSD-3-Clause;
ISC;
Apache-2.0;
Apache 2.0;
MPL-2.0;
CC0-1.0;
CC-BY-3.0;
CC-BY-4.0;
Python-2.0;
Artistic-2.0;
Zlib;
Unlicense;
UNLICENSED;
BlueOak-1.0.0;
# [email protected] - BSD-3-Clause
# [email protected] - BSD-2-Clause
# [email protected] - MIT
# It has to be one line, there must be no space between packages.
jobs:
generate-matrix:
name: Lists modules
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- run: |
DIRS=$(find -not \( -path \*node_modules -prune \) -type f -name package.json | xargs dirname | awk -v RS='' -v OFS='","' 'NF { $1 = $1; print "\"" $0 "\"" }')
echo "matrix=[${DIRS}]" >> $GITHUB_OUTPUT
id: set-matrix
license-check:
needs: [generate-matrix]
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
dir: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout latest code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install license checker
run: npm install -g license-checker
- name: Install dependencies
run: npm ci
- name: Check licenses in ${{ matrix.dir }}
working-directory: ${{ matrix.dir }}
run: npx license-checker --json --onlyAllow="$ALLOWED_LICENSES" --excludePackages "$EXCLUDE_PACKAGES"