name: Scheduled build triggerer

on:
  # Allow manual runs through the web UI
  workflow_dispatch:
  schedule:
    #        ┌───────── minute (0 - 59)
    #        │ ┌───────── hour (0 - 23)
    #        │ │ ┌───────── day of the month (1 - 31)
    #        │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
    #        │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
    - cron: '0 7 * * 3'  # Every Wed at 07:00 UTC

permissions: {}

jobs:
  dispatch_release_branches:
    if: github.repository == 'sunpy/sunpy'
    permissions:
      actions: write
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - branch: "main"
          - branch: "7.0"
    steps:
      - name: Trigger workflow dispatch for CI workflow
        uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1.3.1
        with:
          workflow: CI
          ref: "${{ matrix.branch }}"

      - name: Trigger workflow dispatch for Cron workflow
        uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1.3.1
        with:
          workflow: Cron
          ref: "${{ matrix.branch }}"
