diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml index c13e73d..386e601 100644 --- a/.github/workflows/qodana_code_quality.yml +++ b/.github/workflows/qodana_code_quality.yml @@ -17,14 +17,25 @@ jobs: pull-requests: write checks: write steps: - - uses: actions/checkout@v3 + # Checkout for pull_request events: use the PR head SHA for accurate analysis + - name: Checkout (pull_request) + if: ${{ github.event_name == 'pull_request' }} + uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit + ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 # a full history is required for pull request analysis + + # Checkout for push and other events (e.g., merges to develop): use the current commit + - name: Checkout (push/other) + if: ${{ github.event_name != 'pull_request' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: 'Qodana Scan' uses: JetBrains/qodana-action@v2025.2 with: - pr-mode: false + # Enable PR-specific reporting only for pull_request events + pr-mode: ${{ github.event_name == 'pull_request' }} env: QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_268690425 }} QODANA_ENDPOINT: 'https://qodana.cloud'