Skip to content

Commit 68e6f19

Browse files
feat(ci): add dash dependency check
1 parent a92f19e commit 68e6f19

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: 'Dependency Review'
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
Check-Allowed-Licenses:
13+
runs-on: ubuntu-latest
14+
continue-on-error: false
15+
if: ${{ github.event_name == 'pull_request' }}
16+
steps:
17+
- name: 'Checkout Repository'
18+
uses: actions/checkout@v3
19+
- name: 'Dependency Review'
20+
uses: actions/dependency-review-action@v3
21+
with:
22+
fail-on-severity: critical
23+
# Representation of this list: https://www.eclipse.org/legal/licenses.php#
24+
# Expressed with the help of the following IDs: https://spdx.org/licenses/
25+
allow-licenses: >-
26+
Adobe-Glyph, Apache-1.0, Apache-1.1, Apache-2.0, Artistic-2.0, BSD-2-Clause, BSD-3-Clause,
27+
BSD-4-Clause, 0BSD, BSL-1.0, CDDL-1.0, CDDL-1.1, CPL-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-2.5,
28+
CC-BY-SA-3.0, CC-BY-SA-4.0, CC0-1.0, EPL-1.0, EPL-2.0, FTL, GFDL-1.3-only, IPL-1.0, ISC,
29+
MIT, MIT-0, MPL-1.1, MPL-2.0, NTP, OpenSSL, PHP-3.01, PostgreSQL, OFL-1.1, Unlicense,
30+
Unicode-DFS-2015, Unicode-DFS-2016, Unicode-TOU, UPL-1.0, W3C-20150513, W3C-19980720, W3C,
31+
WTFPL, X11, Zlib, ZPL-2.1
32+
33+
Dash-Dependency-Check:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: ./.github/actions/setup-build
38+
- name: Download latest Eclipse Dash
39+
run: |
40+
curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar
41+
- name: Regenerate DEPENDENCIES
42+
run: |
43+
# dash returns a nonzero exit code if there are libs that need review. the "|| true" avoids that
44+
./gradlew allDependencies | grep -Poh "(?<=\s)[\w.-]+:[\w.-]+:[^:\s\[\]]+" | sort | uniq | java -jar dash.jar - -summary DEPENDENCIES-gen || true
45+
46+
# log warning if restricted deps are found
47+
grep -E 'restricted' DEPENDENCIES | if test $(wc -l) -gt 0; then
48+
echo "::warning file=DEPENDENCIES,title=Restricted Dependencies found::Some dependencies are marked 'restricted' - please review them"
49+
fi
50+
51+
# log error and fail job if rejected deps are found
52+
grep -E 'rejected' DEPENDENCIES | if test $(wc -l) -gt 0; then
53+
echo "::error file=DEPENDENCIES,title=Rejected Dependencies found::Some dependencies are marked 'rejected', they cannot be used"
54+
exit 1
55+
fi
56+
- name: Check for differences
57+
run: |
58+
diff DEPENDENCIES DEPENDENCIES-gen

0 commit comments

Comments
 (0)