Github Action no longer showing bot comment and does not perform the SonarCloud Code Analysis check

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 :
image

vs what it does now

image

And now it seems to wait for the code analysis that never starts:

Hello @lop,

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.

Sure @TomVanBraband .
The id is AXdllv-ltnEHKibMkQqj
and the date info is
date : Feb 2, 2021
started: 8:52:10 PM
finished :8:52:12 PM

Hello @lop,

Do you have the SonarCloud application installed on your GitHub organization? Did you have it installed in the past and did you remove by any chance?

Could you also share the configuration of your GitHub action? This would help us debug your problem.

hey @TomVanBraband ,

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

hey @TomVanBraband were you able to find anything on your end?

Hello @lop,

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.

1 Like

We ended up unbinding and rebinding, this did the trick.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.