# See https://github.com/github/codeql-action/tree/v1 for more information.

name: CodeQL

on:
  push:
    branches: [main, stable-*]
    paths:
      - .github/workflows/codeql.yml
      - "**/*.go"
      - "**/*.js"
      - "**/*.jsx"
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [main, stable-*]
    paths:
      - .github/workflows/codeql.yml
      - "**/*.go"
      - "**/*.js"
      - "**/*.jsx"

jobs:
  analyze:
    name: Analyze
    runs-on: ${{ vars.LINKERD2_RUNNER || 'ubuntu-24.04' }}
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language:
          - go
          - javascript

    steps:
      - name: Checkout
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
      - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
        with:
          go-version: "1.24"

      - name: Initialize
        # Unpinned action version so that we automatically get analyzer updates.
        uses: github/codeql-action/init@v3
        with:
          languages: ${{ matrix.language }}

      - name: Analyze
        uses: github/codeql-action/analyze@v3
