Skip to content

Commit 668e65c

Browse files
committed
feat: Add workflow to run analysis on C# files.
1 parent addb1d8 commit 668e65c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/cs-linter.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: C# Linter
2+
3+
on:
4+
workflow_dispatch: # Allows manual execution via GitHub CLI
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v3
16+
with:
17+
dotnet-version: 8.0.x # Adjust as needed
18+
19+
- name: Find C# files in target directories (excluding EOS_SDK)
20+
id: find-files
21+
run: |
22+
CS_FILES=$(find Assets com.playeveryware.eos -type f -name "*.cs" ! -path "com.playeveryware.eos/Runtime/EOS_SDK/*" | tr '\n' ' ')
23+
echo "Found C# files:"
24+
echo "$CS_FILES"
25+
echo "FILES=$CS_FILES" >> $GITHUB_ENV
26+
27+
- name: Run Roslyn Analyzers on Selected C# Files
28+
if: env.FILES != ''
29+
continue-on-error: true # Allow warnings but don’t fail the workflow
30+
run: |
31+
for file in $FILES; do
32+
echo "Analyzing $file"
33+
dotnet build --no-restore /warnaserror- /p:AnalysisLevel=latest "$file"
34+
done
35+
36+
- name: Post Warnings as PR Comments
37+
if: env.FILES != ''
38+
uses: mshick/add-pr-comment@v2
39+
with:
40+
message: "⚠️ Code analysis found warnings in this PR. While these are not blocking, consider addressing them for better code quality. 🚀"

0 commit comments

Comments
 (0)