Skip to content

ci: trigger SonarCloud on repository default branch#54

Merged
igorsatsyuk merged 1 commit into
masterfrom
fix/sonar-default-branch-trigger
May 25, 2026
Merged

ci: trigger SonarCloud on repository default branch#54
igorsatsyuk merged 1 commit into
masterfrom
fix/sonar-default-branch-trigger

Conversation

@igorsatsyuk
Copy link
Copy Markdown
Owner

Почему не запускался Sonar

В workflow шаг Sonar запускался на push только для refs/heads/main, а default branch репозитория — master.

Что исправлено

  • В .github/workflows/ci.yml условие обновлено с хардкода ветки на универсальную проверку:
    • было: github.ref == ''refs/heads/main''
    • стало: github.ref_name == github.event.repository.default_branch

Результат

Шаг Sonar теперь запускается на push в актуальную default branch репозитория независимо от ее имени (master/main/другое).

Copilot AI review requested due to automatic review settings May 25, 2026 13:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes SonarCloud analysis not running on push because the workflow previously hardcoded refs/heads/main while the repository’s default branch is master. The SonarCloud step is now gated by a comparison against the repository’s configured default branch name, making it branch-name agnostic.

Changes:

  • Updated the SonarCloud step if: condition to run on push only when github.ref_name matches github.event.repository.default_branch.
  • Preserved the existing pull_request condition (still skipping dependabot[bot]).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@igorsatsyuk igorsatsyuk self-assigned this May 25, 2026
@igorsatsyuk igorsatsyuk merged commit 5cfbc76 into master May 25, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown

🧪 Test Results

Unit Tests

  • Total:
  • Passed: 100
  • Failed: 0
  • Skipped: 0

Integration Tests

  • Total:
  • Passed: 54
  • Failed: 0
  • Skipped: 0

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants