Skip to content

Commit

Permalink
NEW Check that all dependency licenses are permissive
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 19, 2024
1 parent 752055a commit 5976f25
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ Run Silverstripe CI matrix tests
Only intended to be used within [gha-ci](https://github.com/silverstripe/gha-ci). The inputs all come from the matrix generated as a part of that workflow.

GitHub job permissions required: `none`

## JS license checking

This action will check the licences of any installed NPM dependencies against a list of allowed SPDX identifiers of open source licences. These are contained in semi-colon delimited list in `allowed-spdx-delimited.txt`. If any insalaled non-dev dependencies are found that are not in the allowed list then the job will fail. See https://spdx.org/licenses/ for a list of SPDX identifiers.

Note that the `Unlicense` is an SPDX identifier for an actual license and not a placeholder for a missing license.

Composer dependences are checked seperately in `ci.yml` of `silverstripe/recipe-kitchen-sink`.
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ runs:
echo "Running yarn lint"
yarn run lint
fi
# Validate licenses of all NPM dependencies are allowed
echo "Checking licenses of all dependencies"
# The following NPM package report as UNKNOWN or UNLICENSED, though have been manually checked they have permissive licenses:
EXCLUDE_PACKAGES='[email protected];[email protected];@silverstripe/[email protected];[email protected];[email protected]'
npm install -g license-checker
SPDX_ALLOWED_DELIMITED=$(cat ${{ github.action_path }}/allowed-spdx-delimited.txt | tr -d '\n')
license-checker --production --unknown --out /dev/null --onlyAllow "$SPDX_ALLOWED_DELIMITED" --excludePackages "$EXCLUDE_PACKAGES"
# If we get to this point, everything was successful
echo "Passed"
- name: "Run PHP linting"
Expand Down
1 change: 1 addition & 0 deletions allowed-spdx-delimited.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIT;MIT-0;ISC;0BSD;BSD-2-Clause;BSD-3-Clause;Apache-2.0;Python-2.0;CC0-1.0;CC-BY-3.0;CC-BY-4.0;Public Domain;Unlicense

0 comments on commit 5976f25

Please sign in to comment.