From 56223a474e8638a52013c430e58ed50806357b4b Mon Sep 17 00:00:00 2001 From: Zhelyazko Zhelyazkov Date: Wed, 25 Dec 2024 20:14:23 +0200 Subject: [PATCH] Update StyleCop Validation.yml --- .github/workflows/StyleCop Validation.yml | 29 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/StyleCop Validation.yml b/.github/workflows/StyleCop Validation.yml index 6b178ae..ef6f0c5 100644 --- a/.github/workflows/StyleCop Validation.yml +++ b/.github/workflows/StyleCop Validation.yml @@ -1,15 +1,34 @@ name: Code Analysis -on: [push, pull_request] + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] jobs: analyze: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 + # Checkout the repository + - name: Checkout Code + uses: actions/checkout@v4 + + # Setup .NET - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0.x - - name: Run StyleCop - run: dotnet tool run stylecop + dotnet-version: '9.0.x' + + # Restore dependencies + - name: Restore Dependencies + run: dotnet restore + + # Build and analyze code with StyleCop + - name: Analyze Code with StyleCop + run: dotnet build --no-restore -warnaserror + # Run Unit Tests (optional, but recommended) + - name: Run Unit Tests + run: dotnet test --no-build --verbosity normal