Not all long-lives branches being shown

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub)
  • CI system used (GitHub Actions)
  • Scanner command used when applicable (private details masked)
  • Languages of the repository (JS/TS)

We have 2 long-lived branches staging and prod. We merge PRs into staging and then once staging is stable we merge a big PR from staging into prod. Therefore, having analysis on both staging and prod would be nice.

However, I’ve only been able to get staging to show up in SonarCloud. My RegEx for the long-lived branches in simply (prod|staging). However, the following is all I see in SonarCloud. I’ve double-checked GitHub and my branch is called prod (instead of something like production). Is there something I’m missing? We merge from staging to prod a few times a week, so there has been plenty of opportunities for SonarCloud to detect this change. Thank you.

Hey there.

Can you share your GitHub Actions YML file?

Sure, it’s very similar to the one provided by SonarCloud.

name: Sonar Cloud

on:
  push:
    branches:
      - staging
  workflow_call:

jobs:
  sonarcloud:
    name: Sonar Cloud
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

This workflow triggers just fine when opening or updating a PR.

Seems like you’ll want to add other branches (or all *) if you want the workflow to run on other branches.