Skip to content

Commit

Permalink
ci(dependency-review): Add depcheck to workflow for detecting unused …
Browse files Browse the repository at this point in the history
…dependencies
  • Loading branch information
divinetettey committed Jun 5, 2024
1 parent 888aeab commit 3eee49d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,22 @@ jobs:
fail-on-severity: high
allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, BSD-2-Clause, Unlicense, CC0-1.0, 0BSD, X11, MPL-2.0, MPL-1.0, MPL-1.1, MPL-2.0
fail-on-scopes: development, runtime
allow-dependencies-licenses: 'pkg:npm/caniuse-lite'
allow-dependencies-licenses: 'pkg:npm/caniuse-lite'
- name: 'Setup Node.js'
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: 'Install depcheck globally'
run: npm install -g depcheck
- name: 'Run depcheck'
run: |
depcheck_result=$(depcheck --oneline --skip-missing)
if [[ $depcheck_result == *"Unused dependencies"* ]] || [[ $depcheck_result == *"Unused devDependencies"* ]]
then
echo "Unused dependencies or devDependencies found."
echo "$depcheck_result"
exit 1
fi

0 comments on commit 3eee49d

Please sign in to comment.