Skip to content

Commit 09423f0

Browse files
Merge pull request #276 from docknetwork/chore/license-check-action
add action for checking open source licenses
2 parents 9e57f2b + ee8c5c2 commit 09423f0

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/npm-audit.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: npm audit
2+
3+
on:
4+
workflow_dispatch:
5+
6+
pull_request:
7+
branches:
8+
- master
9+
paths:
10+
- "yarn.lock"
11+
- ".github/workflows/**"
12+
13+
schedule:
14+
- cron: '0 0 * * 0' # Every sunday at midnight
15+
16+
jobs:
17+
audit:
18+
runs-on: ubuntu-latest
19+
env:
20+
NODE_VERSION: 18.x
21+
AVOID_LICENSES: "AGPL;GPL;AGPL-3.0"
22+
IGNORE_PACKAGES: ""
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
with:
28+
persist-credentials: false
29+
- name: Use Node.js ${{ env.NODE_VERSION }}
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ env.NODE_VERSION }}
33+
34+
- name: Install dependencies
35+
run: |
36+
yarn install
37+
38+
- name: Check licenses
39+
run: npx --yes license-checker --production --failOn "${{ env.AVOID_LICENSES }}" --excludePackages "${{ env.IGNORE_PACKAGES }}"
40+
41+
- name: Run audit
42+
run: /bin/bash -c "(yarn audit --groups 'dependencies' --level critical; [[ $? -ge 16 ]] && exit 1 || exit 0)"

0 commit comments

Comments
 (0)