name: CodeQL Security Scan

on:
  push:
    branches: ["main", "master"]
  pull_request:
    branches: ["main", "master"]
  schedule:
    - cron: "27 4 * * 1"
  workflow_dispatch:

permissions:
  contents: read

jobs:
  analyze:
    name: Analyze Python with CodeQL
    runs-on: ubuntu-latest
    timeout-minutes: 30
    permissions:
      actions: read
      contents: read
      security-events: write

    steps:
      - name: Checkout
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Initialize CodeQL (Python)
        uses: github/codeql-action/init@256d634097be96e792d6764f9edaefc4320557b1 # v4
        with:
          languages: python
          build-mode: none

      - name: Analyze and Upload SARIF
        uses: github/codeql-action/analyze@256d634097be96e792d6764f9edaefc4320557b1 # v4