Skip to content

CI: make Codacy SARIF upload resilient to empty runs#194

Merged
abhimehro merged 3 commits intomainfrom
chore/codacy-sarif-empty-runs
Feb 13, 2026
Merged

CI: make Codacy SARIF upload resilient to empty runs#194
abhimehro merged 3 commits intomainfrom
chore/codacy-sarif-empty-runs

Conversation

@abhimehro
Copy link
Owner

Codacy Security Scan has been intermittently failing at the SARIF upload step with:

Invalid request. 1 item required; only 0 were supplied.

The failing run showed github/codeql-action/upload-sarif@v3 attempting to upload results.sarif.

This PR adds a small normalization step that ensures the generated SARIF contains at least one runs entry before upload. GitHub code scanning rejects SARIF payloads with 0 runs, even when there are 0 findings.

SECURITY NOTE:

  • The normalization step is local-only (no network calls) and does not touch secrets.
  • It preserves existing SARIF content when runs are present.

Co-Authored-By: Warp agent@warp.dev

Co-Authored-By: Warp <agent@warp.dev>
Copilot AI review requested due to automatic review settings February 13, 2026 03:04
@trunk-io
Copy link

trunk-io bot commented Feb 13, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@gemini-code-assist
Copy link

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

Co-Authored-By: Warp <agent@warp.dev>
@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

Copy link

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 addresses intermittent failures in the Codacy Security Scan workflow caused by GitHub's code scanning API rejecting SARIF files with empty runs arrays. The fix adds a normalization step that ensures at least one (empty) run entry exists in the SARIF output before upload.

Changes:

  • Added a Python normalization script between the Codacy analysis and SARIF upload steps
  • Script validates the SARIF file exists and contains valid JSON
  • When runs is missing or empty, inserts a minimal valid SARIF run entry to satisfy GitHub's API requirements
  • Preserves existing SARIF content when runs are already present

Co-Authored-By: Warp <agent@warp.dev>
@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

@abhimehro abhimehro merged commit 0e84384 into main Feb 13, 2026
13 checks passed
@abhimehro abhimehro deleted the chore/codacy-sarif-empty-runs branch February 13, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants