Skip to content

Commit 02db2fe

Browse files
[Add] nuget-reference-check
1 parent 2982532 commit 02db2fe

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "nuget package reference check"
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 8 * * *'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
# We must fetch at least the immediate parents so that if this is
17+
# a pull request then we can checkout the head.
18+
fetch-depth: 2
19+
20+
- name: Setup .NET Environment
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: 8.0.x
24+
25+
- name: Install dependencies
26+
run: dotnet restore EcoreNetto.sln
27+
28+
- name: Build
29+
run: dotnet build EcoreNetto.sln --no-restore /p:ContinuousIntegrationBuild=true
30+
31+
- name: Checking NuGet vulnerabilites
32+
run: |
33+
set -e
34+
dotnet list EcoreNetto.sln package --outdated --include-transitive
35+
36+
dotnet list EcoreNetto.sln package --deprecated --include-transitive
37+
38+
dotnet list EcoreNetto.sln package --vulnerable --include-transitive 2>&1 | tee vulnerabilities.log
39+
40+
echo "Analyze dotnet list package command log output..."
41+
if grep -q -i "\bcritical\b\|\bhigh\b\|\bmoderate\b\|\blow\b" vulnerabilities.log; then
42+
echo "Security Vulnerabilities found"
43+
exit 1
44+
else
45+
echo "No Security Vulnerabilities found"
46+
exit 0
47+
fi

0 commit comments

Comments
 (0)