Skip to content

Skip CodeQL Python job when no Python sources are present#12464

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-analyze-python-job
Draft

Skip CodeQL Python job when no Python sources are present#12464
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-analyze-python-job

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown

Description

The Analyze (python) CodeQL job failed with “no source code seen during build” because Python analysis was always included, even when the scanned ref had no tracked .py files. This change makes the CodeQL language matrix conditional so Python analysis only runs when Python sources exist.

  • Root cause
    • CodeQL default setup generated a Python analysis job unconditionally.
  • What changed
    • Added an explicit .github/workflows/codeql.yml.
    • Added a detect-languages job that builds the matrix from repository contents:
      • always includes actions
      • includes python only if git ls-files '*.py' returns matches
    • analyze now consumes that dynamic matrix.
  • Security/workflow hygiene
    • Added explicit top-level workflow token permissions (contents: read).
- name: Build language matrix
  id: set-matrix
  run: |
    include='[{"language":"actions","build-mode":"none"}]'

    if git ls-files '*.py' | grep -q .; then
      include='[{"language":"actions","build-mode":"none"},{"language":"python","build-mode":"none"}]'
    fi

    echo "matrix={\"include\":$include}" >> "$GITHUB_OUTPUT"

Type of change

(Please delete options that are not relevant)

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ⚡ New feature (non-breaking change which adds functionality)
  • 📢 Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • 📄 This change requires a documentation update

Verification Process

To ensure the changes are working as expected:

  • Test Location: .github/workflows/codeql.yml (dynamic language matrix generation).
  • Verification Steps: Confirm matrix includes python when tracked .py files exist and excludes it when none exist; validate Analyze (actions) still runs.

Additional Media:

  • I have attached a brief loom video or screenshots showcasing the new functionality or change.

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues.
  • Relevant unit and integration tests are updated or added.

Comment thread .github/workflows/codeql.yml Fixed
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Analyze (python) Skip CodeQL Python job when no Python sources are present Jun 8, 2026
Copilot AI requested a review from lucas-koontz June 8, 2026 16:22
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.

3 participants