name: codeql

# GitHub's free SAST scanning. Runs on push to main, on PRs, and weekly.
# Findings appear under the repo's Security tab.

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  schedule:
    - cron: "37 6 * * 1"   # Mondays 06:37 UTC (16:37 AEST) — off-peak

jobs:
  analyze:
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write
    strategy:
      fail-fast: false
      matrix:
        language: [python]
    steps:
      - uses: actions/checkout@v5

      - name: Initialise CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: ${{ matrix.language }}
          queries: security-extended

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

      - name: Analyze
        uses: github/codeql-action/analyze@v3
        with:
          category: "/language:${{ matrix.language }}"
