diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 76d6f32..95cca57 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -12,13 +12,17 @@ jobs: env: PATH: ${{ env.PATH }}:/root/.dotnet/tools steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Checkout code + run: | + echo "Checking out code..." + echo "Current directory: $(pwd)" + echo "Files in current directory:" + ls -la - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + run: | + echo "Setting up .NET..." + dotnet --version + echo "Dotnet is available" - name: Install SonarQube Cloud scanner run: | mkdir -p ~/.sonar/scanner @@ -42,7 +46,12 @@ jobs: echo "Listing files:" ls -la echo "Installing SonarQube scanner..." - ~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml + if [ -n "$SONAR_TOKEN" ]; then + ~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml + echo "SonarQube analysis started" + else + echo "SONAR_TOKEN not set, skipping SonarQube analysis" + fi - name: Build project run: | @@ -77,4 +86,9 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | echo "Ending SonarQube analysis..." - ~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file + if [ -n "$SONAR_TOKEN" ]; then + ~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" + echo "SonarQube analysis completed" + else + echo "SONAR_TOKEN not set, skipping SonarQube analysis" + fi \ No newline at end of file