name: CodeQL

# CodeQL analysis - runs on PRs and weekly schedule.
# Main branch pushes are handled by release.yml to avoid duplicate CI runs.
# Security analysis is already done in PR checks, weekly schedule catches any gaps.

on:
  pull_request:
    branches: [ main ]
  schedule:
    - cron: '0 3 * * 1' # Weekly, Mondays 03:00 UTC

permissions:
  contents: read
  security-events: write

jobs:
  analyze:
    name: Analyze (CodeQL)
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v4
        with:
          languages: python

      - name: Autobuild
        uses: github/codeql-action/autobuild@v4

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v4

