Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

chore: Syncs common workflows from the template into main #17

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/nodejs-license.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Node license check

on: pull_request

env:
ALLOWED_LICENSES: >
MIT;
BSD;
ISC;
Apache-2.0;
Apache 2.0;
MPL-2.0;
LGPL-3.0;
LGPL-3.0-or-later;
CC0-1.0;
CC-BY-3.0;
CC-BY-4.0;
Python-2.0;
PSF;
Public Domain;
WTFPL;
Unlicense;
# It has to be one line, there must be no space between packages.
EXCLUDE_PACKAGES: testrpc@0.0.1;uuid@2.0.1;

jobs:
generate-matrix:
name: Lists modules
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- run: |
DIRS=$(find -not \( -path \*node_modules -prune \) -type f -name yarn.lock | 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
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: 16.15.1

- name: Install yarn
run: npm install -g yarn license-checker

- name: Install dependencies in ${{ matrix.dir }}
working-directory: ${{ matrix.dir }}
run: yarn install

- name: Check licenses in ${{ matrix.dir }}
working-directory: ${{ matrix.dir }}
run: npx license-checker --json --onlyAllow="$ALLOWED_LICENSES" --excludePackages "$EXCLUDE_PACKAGES"