name: codeql

on:
  schedule:
    #        ┌───────────── minute (0 - 59)
    #        │ ┌───────────── hour (0 - 23)
    #        │ │ ┌───────────── day of the month (1 - 31)
    #        │ │ │ ┌───────────── month (1 - 12)
    #        │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)
    #        │ │ │ │ │
    #        │ │ │ │ │
    #        │ │ │ │ │
    #        * * * * *
    - cron: '0 9 * * 4'

jobs:
  codeql:
    runs-on: ubuntu-20.04
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 2
      -
        name: Checkout HEAD on PR
        if: ${{ github.event_name == 'pull_request' }}
        run: |
          git checkout HEAD^2
      -
        name: Initialize CodeQL
        uses: github/codeql-action/init@v2
        with:
          languages: go
      -
        name: Autobuild
        uses: github/codeql-action/autobuild@v2
      -
        name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v2
