ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
Languages of the repository (typescript/js)
Hi there,
A few days ago we realized that the sonar github action is no longer posting the sonar bot quality comment in GitHub pull requests, and it seems to no longer do the Code Analysis step. Did something change recently? All I could find that was similar was this post Github actions check stopped working unexpectedly? - #22 by TomVanBraband
And it seems like this problem was resolved about a month ago. We haven’t made any changes to sonar files or the GitHub action.
Here is what the action used to do :
vs what it does now
And now it seems to wait for the code analysis that never starts:
Could you check to see if the analysis still makes it to your project on sonarcloud.io? If so could you give me a background task ID of a recent one and let me know the date of the analysis? You can find this information by navigating to your project on SonarCloud and clicking on Administration > Background Tasks.
Yes we do and we haven’t touched it in a couple of months.
Same goes for the github action yml file, I only updated the github action from 1.4 to 1.5 in an effort to fix the problem but it didn’t seem to change anything.
Here is the yml:
# This is a basic workflow to help you get started with Actions
name: SonarCloud Scan
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "sonarcloud"
sonarcloud:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
# Build the application
- name: Build Project
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
- run: npm run build
- run: npm run test-coverage
env:
CI: true
# Fix bogus paths
# https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747/3
- name: fix code coverage paths
working-directory: ./coverage/app
run: |
sed -i 's/\/home\/runner\/work\/ourproject\/ourproject\//\/github\/workspace\//g' lcov.info
# Runs a SonarCloud Scan
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v1.5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sorry for the delay. I confirm we have made changes that stopped support for your specific usecase.
To continue receiving PR decoration you will have to add an extra connection between your SonarCloud organization and GitHub organization. You can do this by navigating to your organization on SonarCloud > Administration > Organization Settings > Bind this organization to GitHub.
Afterwards you should receive SonarCloud comments on your PRs again!
Let me know if this helped.