Integrating a CodeQuality Scanner into Github Actions

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🐞

Well, the SonarCloud is very used

2️⃣Hands On✍

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

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

Create Organization👥

2️⃣Hands On✍

Inside the web ,get the SONAR_TOKEN

✏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

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 }}

🎬Run The Action

Done 🚀

Leave a Reply

Your email address will not be published. Required fields are marked *