← All insightsIntegration

How to use SonarQube with GitHub Actions

Nir Geier, CodeWizard · 13 April 2025 · 3 min read · Intermediate

SonarQube and GitHub Actions are a common pairing in a modern DevOps stack. Here is how they fit together and a practical way to wire them up.

Where SonarQube fits

SonarQube statically analyzes code for bugs, vulnerabilities, security hotspots and 'code smells', and enforces a Quality Gate in CI so problematic changes fail the build.

properties
# sonar-project.properties
sonar.projectKey=acme-web
sonar.sources=src
sonar.tests=test
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.qualitygate.wait=true

Where GitHub Actions fits

GitHub Actions runs event-driven workflows (on push, PR, schedule, etc.) defined as YAML in .github/workflows, using reusable 'actions' from the marketplace or your own repos.

yaml
name: ci
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix: { node: [18, 20, 22] }
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: ${{ matrix.node }}, cache: npm }
      - run: npm ci
      - run: npm test

Making them work together

  • Enforce a 'new code' Quality Gate on every PR
  • Wire coverage reports into the scan
  • Pin actions to a commit SHA and review third-party actions before use
  • Use OIDC for cloud auth and set minimal permissions blocks

Want this pairing set up properly, with docs and handover? That is exactly the kind of work CodeWizard's embedded senior engineers do - and both SonarQube and GitHub Actions have active community groups you can join for free.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult