SonarQube main branch analysis with github

We are on latest version of SonarQube Enterprise Edition. We have our main branch in GitHub set to develop. Our pull requests run a pr-verification action and Pull Request analysis work as expected. My question is how do I get the analysis to run on our develop branch? We don’t run sonarscan locally and we don’t have any other CI/CD tool setup. We rely soley on GitHub Actions… Should I setup an action to run on merge to develop to run the scan with sonar.branch.name set to develop?

1 Like

It would be great if someone else has had experience with this that could help :frowning:

Hi @CWSites ,
There should be a directive in your GitHub workflow yaml file to trigger the scan on each push on develop. Something like

on:
  push:
    branches:
      - master # or the name of your main branch

Can you please share your workflow file?

Christophe

Okay, so I’ll create a new workflow that only targets develop which is our main branch. Currently I only have it run on PR verification

Hi @CWSites ,
sorry for late reply.
You don’t have to create a new workflow, you can add the branch directive in the same .yaml file.
It looks like

Thanks, I’ll give this a shot when I get a moment.