Cache Issues and Scanner Running All Files in GitHub Actions

  • ALM used: GitHub
  • CI system used: Github Actions
  • Scanner command used: SonarCloud Github Actions
  • Languages of the repository: mainly Typescript (others JS, Python…)
  • Repository type: Monorepo

Errors observed

...

Cache strategy set to 'WRITE_ONLY' for file 'libs/domain/...' as current analysis requires all files to be analyzed.

...

INFO: Sensor JavaScript/TypeScript analysis [javascript]
INFO: Detected os: Linux arch: amd64 alpine: true. Platform: UNSUPPORTED
INFO: Using Node.js executable: 'node'.
INFO: Resolving TSConfig files using 'tsconfig.base.json' from property sonar.typescript.tsconfigPaths
INFO: Found 1 TSConfig file(s): [/github/workspace/tsconfig.base.json]
INFO: Creating TypeScript program
INFO: TypeScript configuration file /github/workspace/tsconfig.base.json
INFO: 7427 source files to be analyzed
INFO: Creating TypeScript program (done) | time=9065ms
INFO: Starting analysis with current program
INFO: 1/7427 file analyzed, current file: /github/workspace/jest.config.ts
INFO: 98/7427 files analyzed, current file: /github/workspace/libs/......
...
INFO: Hit the cache for 0 out of 7427.
INFO: Miss the cache for 7427 out of 7427: ANALYSIS_MODE_INELIGIBLE [7427/7427].

...

DEBUG: File already analyzed: '/github/workspace/libs/domain/...'. Check your project configuration to avoid files being part of multiple projects.

Steps to reproduce

  1. Trigger a pull request in the GitHub repository.
  2. Observe the GitHub Actions workflow.
  3. Notice that the SonarCloud Scanner is analyzing all files instead of only the changed ones in the monorepo.
  4. Cache issues are observed during the process, with all files missing the cache.
  5. Despite setting only one TSConfig file as suggested in other topics, the “File already analyzed” warning persists.

Questions

  1. What does “Platform: UNSUPPORTED” mean in the logs?
  2. What is the cause of the “ANALYSIS_MODE_INELIGIBLE” message?
  3. Why is the cache always missed, even for minor changes like updating the sonar-project.properties file in the monorepo?
  4. How can I resolve the “File already analyzed” warning in our monorepo, given that I’ve already tried the recommended solution of setting only one TSConfig file?

Potential workaround
Currently, I haven’t identified a workaround. Looking for insights from the community.

Please Disregard the Previous Issue

I’ve identified the root cause of the problem. The oversight was in the GitHub Actions configuration: I was using on:push instead of on:pull_request. As a result, the environment variables specific to Pull Requests weren’t being set up correctly. My apologies for any confusion, and thank you for your patience.

1 Like

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