Manually triggered Github workflows on branches are pushed to main on sonarcloud.io

Template for a good new topic, formatted with Markdown:

  • ALM used: GitHub
  • CI system used: GitHub
  • Scanner command used: `./gradlew sonar --info
  • Languages of the repository: Kotlin
  • Error observed: When manually starting a workflow on a branch or tag, the results are publish on Sonarcloud.io as if run on the main branch. I expect this to be published as a branch run, shown in the Branches overview.
  • Steps to reproduce: Manually trigger a Github workflow on a gradle project on a branch.
  • Potential workaround: None known so far.

This seems to be the exact issue as described here: SonarCloud Github: always pushed to main branch on "workflow_dispatch"

Hey there!

We’ve seen this before. @sodul was kind enough to provide a workaround:

and I confirm there’s a ticket in our backlog to autoconfigure the branch when executed via workflow_dispatch