# Copyright 2025 The go-yaml Project Contributors
# SPDX-License-Identifier: Apache-2.0

name: CodeQL Advanced

on:
  push:
    branches: [ main, v3, v2, v1 ]
  pull_request:
    branches: [ main, v3, v2, v1 ]
  schedule:
  - cron: 17 13 * * 3

permissions: read-all

jobs:
  analyze:
    name: Analyze (${{ matrix.language }})
    runs-on: ubuntu-latest
    permissions:
      # required for all workflows
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        include:
        - language: actions
          build-mode: none
        - language: go
          build-mode: autobuild

    steps:
    - name: Checkout repository
      uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3
      with:
        persist-credentials: false

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      # yamllint disable-line rule:line-length
      uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463  # v4.36.1
      with:
        languages: ${{ matrix.language }}
        build-mode: ${{ matrix.build-mode }}

    - name: Perform CodeQL Analysis
      # yamllint disable-line rule:line-length
      uses: github/codeql-action/analyze@87557b9c84dde89fdd9b10e88954ac2f4248e463  # v4.36.1
      with:
        category: /language:${{matrix.language}}
