DEV Community

Cover image for Integrating a CodeQuality Scanner into Github Actions
Lester Diaz Perez
Lester Diaz Perez

Posted on • Updated on

Integrating a CodeQuality Scanner into Github Actions

🎯Workflow

1️⃣Search🔍 the CodeQuality scanner tool
2️⃣Hands On✍


1️⃣Search🔍 the CodeQuality scanner tool

  • As always Let's go to the 🛒marketplace
  • Looking for a Codequality scanner🐞

Image description

  • Well, the SonarCloud is very used

Image description

2️⃣Hands On✍

  • Select SonarCloud and complete✅ the process
  • Just select the current repository in which you are working

Image description

  • You will be redirected to login📌 of the web SonarCloud(Just continue with your github account)

Image description

  • Create Organization👥

2️⃣Hands On✍

  • Inside the web ,get the SONAR_TOKEN

Image description

  • ✏Save the SONAR_TOKEN as a secret in the repository
  • Create this file🗒 at the root directory >sonar-project.properties
sonar.projectKey=sharker_sharker
sonar.organization=sharker
sonar.host.url=https://sonarcloud.io
Enter fullscreen mode Exit fullscreen mode
  • Add ➕ this job to the Workflow
 sonarcloud:
    name: SonarCloud
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          # This Token is automatically generated by Github
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

🎬Run The Action

Image description

Done 🚀


LinkedIn

Top comments (1)

Collapse
 
sharker3312 profile image
Lester Diaz Perez

Next week I finish the rest. Greetings👋