tod 0.11.1

An unofficial Todoist command-line client
name: CI • CodeQL
on:
  schedule:
    - cron: '26 17 * * 4'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read
  security-events: write
  packages: read
  actions: read

jobs:
  analyze:
    name: CodeQL (${{ matrix.language }})
    runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - language: actions
            build-mode: none
          - language: rust
            build-mode: none

    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
        with:
          fetch-depth: 0

      # (Optional) Rust toolchain only if you want clippy/fmt in this job; not needed for CodeQL itself.
      - name: Setup Rust (if needed)
        if: matrix.language == 'rust'
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy,rustfmt

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: ${{ matrix.language }}
          build-mode: ${{ matrix.build-mode }}
          config-file: ./.github/workflows/codeql/codeql.yml

      # NOTE: Do NOT run a "manual build" for Rust here. It's ignored by CodeQL when build-mode=none.

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

  clippy:
    name: Clippy + fmt
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v5
      - name: Set up Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy,rustfmt
      - name: Cache cargo dirs
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            cargo-${{ runner.os }}-
      - name: Run Clippy
        run: cargo clippy --all-features --all-targets -- -D warnings
      - name: Check formatting
        run: cargo fmt --all -- --check