name: Check Examples

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  get-leptos-changed:
    uses: ./.github/workflows/get-leptos-changed.yml

  get-examples-matrix:
    uses: ./.github/workflows/get-examples-matrix.yml

  test:
    name: Check
    needs: [get-leptos-changed, get-examples-matrix]
    if: needs.get-leptos-changed.outputs.leptos_changed == 'true'
    strategy:
      matrix: ${{ fromJSON(needs.get-examples-matrix.outputs.matrix) }}
      fail-fast: false
    uses: ./.github/workflows/run-cargo-make-task.yml
    with:
      directory: ${{ matrix.directory }}
      cargo_make_task: "check"
      toolchain: nightly
