0 files indexed after running sonar scans with Github actions

Must-share information (formatted with Markdown):

  • Sonarqube 10.2 community edition
  • Deployed Zip file
  • Trying to run sonar scans with GitHub actions
  • Included sonarqube.yml file in GitHub actions , scans ran successfully but it says 0 indexed files
    for the project which has CICD setup in Team city they are reporting the scans , but for the projects which has build happening in aws those are showing 0 indexed files and in SQ UI showing main branch has no lines of code(This project is created in Sonarqube UI using Local project option)
    Could I get detailed steps for setting up sonar scans through Github actions

Hey there.

A great place to start would be to share your GitHub Actions YML, as well as the logs from your pipeline.

This is Github actions YML

name: SonarQube analysis

on:
  push:
    branches: [ "develop" ]
  pull_request:
    branches: [ "develop" ]
  workflow_dispatch:
  

permissions:
  pull-requests: read # allows SonarQube to decorate PRs with analysis results

jobs:
  Analysis:
    runs-on: [self-hosted,Linux,X64]

    steps:
      - name: Analyze with SonarQube

        # You can pin the exact commit or the version.
        # uses: SonarSource/sonarqube-scan-action@v1.1.0
        uses: SonarSource/sonarqube-scan-action@v3.0.0
        env:
          GITHUB_TOKEN: ${{ secrets.GH_REPO_TOKEN }}  # Needed to get PR information
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_GLOBAL }}   # Generate a token on SonarQube, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
          SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}   # add the URL of your instance to the secrets of this repo with the name SONAR_HOST_URL (Settings > Secrets > Actions > add new repository secret)
          SONAR_ROOT_CERT: ${{ secrets.SONAR_ROOT_CERT }}
        with:
          # Additional arguments for the sonarcloud scanner
          args:
            # Unique key of your project. You can find it in SonarQube > [my project] > Project Information (top-right menu)
            # mandatory
            -Dsonar.projectKey=peoplemanager
            -Dsonar.scm.disabled=true
            # Comma-separated paths to directories containing main source files.
            #-Dsonar.sources= # optional, default is project base directory
            # When you need the analysis to take place in a directory other than the one from which it was launched
            #-Dsonar.projectBaseDir= # optional, default is .
            # Comma-separated paths to directories containing test source files.
            #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/
            # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing.
            #-Dsonar.verbose= # optional, default is false

Great! and the rest?