name: Ecosystem

on:
  schedule:
    - cron: "0 6 * * *" # daily at 06:00 UTC
  workflow_dispatch:

permissions:
  contents: read

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

jobs:
  load-repos:
    runs-on: ubuntu-latest
    outputs:
      repos: ${{ steps.read.outputs.repos }}
    steps:
      - uses: actions/checkout@v4
      - id: read
        run: echo "repos=$(jq -c . .github/repos.json)" >> "$GITHUB_OUTPUT"

  test:
    name: "${{ matrix.repo.name }}"
    needs: load-repos
    strategy:
      fail-fast: false
      matrix:
        repo: ${{ fromJson(needs.load-repos.outputs.repos) }}
    uses: ./.github/workflows/ecosystem-run.yml
    with:
      repo_url: ${{ matrix.repo.url }}
      next_version: "16.1"
