Daily SonarCloud quality gate status board in Teams

By General Input

Every weekday morning, post every failing SonarCloud project into Microsoft Teams, so builds that have been red for a week stop slipping past your team.

Integrations

  • SonarCloud
  • Microsoft Teams

Type

Deterministic Code

Categories

  • Engineering
  • Operations

Every weekday at 8:30am, run a scheduled workflow that builds a quality gate status board for my whole SonarCloud organization and posts it into our engineering channel in Microsoft Teams. The reason this exists: SonarCloud's own notification only fires when a project's main branch transitions from passed to failed or from failed to passed, so a project that has been red for a week is never mentioned again. This workflow reports the current state of everything on every run, so standing failures stay visible.

Step one, list the projects. Use the SonarCloud "Projects — Search" operation with my organization key to get every project in the organization. This endpoint is page based, so page through it using the page number and page size parameters until you have collected every project, rather than assuming the first page is the whole organization. Keep each project's key and its display name.

Step two, get each project's gate result. For every project returned, call the SonarCloud "Quality Gates — Project Status" operation using that project's key. Each response gives an overall status plus the list of individual conditions with their metric, comparator, error threshold, and actual value. Handle projects that have never been analyzed, or that return an error, by skipping them rather than failing the whole run.

Step three, filter. Keep only the projects whose overall status is ERROR. Discard the passing ones entirely, they do not belong in the message.

Step four, format one message. For each failing project include the project display name, the specific conditions that failed, and a direct link to the project at https://sonarcloud.io/project/overview?id= followed by the project key. Translate the raw metric names into plain language so the message is readable at a glance, for example new_coverage becomes "coverage on new code", new_blocker_violations becomes "new blocker issues", and new_duplicated_lines_density becomes "duplicated lines on new code". Where it is useful, show the actual value against the threshold, for example "coverage on new code 62.4% vs required 80%". Only list conditions whose own status is failing, not every condition on the gate. Sort failing projects alphabetically by name so the board reads consistently from day to day, and put a count of failing projects at the top.

Step five, always post something. If no project is in ERROR, post a short all clear line instead of skipping the message, for example "All clear: all 34 projects are passing their quality gate." This matters, because a workflow that stays silent on good days is indistinguishable from a workflow that has silently broken.

Step six, deliver it. Send the finished board as a single message using the Microsoft Teams "Create Channel Message" operation, targeting our engineering team and channel. One message per run, never one message per project.

Two practical notes. SonarCloud returns HTTP 429 when its rate limit is hit, so pace the per project status calls in a larger organization and back off and retry rather than dropping projects from the board. If my organization is on the US instance, the host is sonarqube.us instead of sonarcloud.io, and the project links need to match.

Related prompts

Explore more prompts
Screen chartered vessels for AIS gaps and sanctions red flagsCatch phishing domains impersonating your brand each morningDaily chase-up for unreviewed SonarCloud security hotspotsWeekly code health brief for engineering leadershipTurn critical SonarCloud findings into tracked Jira ticketsClose won in Dynamics 365 and invoice when a contract is signedWeekday Teams reminders for your Blackboard grading backlogAuto-summarize new pull requests in Microsoft TeamsTurn stalled HubSpot deals into Microsoft Planner tasksAuto-triage new ConnectWise PSA tickets and post a Teams digest