From 78f8e08bb99df662c189ec494ddb339d31ac34a7 Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Santos Souza de Miranda Date: Sat, 29 Nov 2025 03:54:13 -0300 Subject: [PATCH] Improve Qodana workflow: adjust checkout logic and enable PR-specific reporting - Use separate checkout steps for pull_request events and other event types - Enable Qodana PR-specific reporting conditionally for pull_request events --- .github/workflows/qodana_code_quality.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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'