Add sonarcloud to GitHub actions
[e-mobility-charging-stations-simulator.git] / .github / workflows / build.yml
index 47a8f675c869b9c5524be246042749e5c84b8d48..5396c211338ce6656dd32cf6d7eaf67d7272cfe5 100644 (file)
@@ -4,6 +4,7 @@ on:
     branches:
       - master
   pull_request:
+    types: [opened, synchronize, reopened]
     branches:
       - master
 jobs:
@@ -33,4 +34,16 @@ jobs:
       run: |
         cd docker
         make SUBMODULES_INIT=false
+   sonarcloud:
+    name: SonarCloud
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+        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:
+          GITHUB_TOKEN: ${{ secrets.USER_TOKEN }}  # Needed to get PR information, if any
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}