name: Build (daily)

on:
  schedule:
    # daily at 3:24 UTC
    - cron: "24 3 * * *"
  workflow_dispatch:

jobs:
  common:
    uses: ./.github/workflows/build-common.yml
    secrets:
      GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

  test-latest-deps:
    uses: ./.github/workflows/reusable-test-latest-deps.yml
    secrets:
      GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

  muzzle:
    uses: ./.github/workflows/reusable-muzzle.yml

  shell-script-check:
    uses: ./.github/workflows/reusable-shell-script-check.yml

  markdown-link-check:
    uses: ./.github/workflows/reusable-markdown-link-check.yml

  markdown-lint-check:
    uses: ./.github/workflows/reusable-markdown-lint-check.yml

  misspell-check:
    uses: ./.github/workflows/reusable-misspell-check.yml

  workflow-notification:
    needs:
      - common
      - test-latest-deps
      - muzzle
      - markdown-link-check
      - misspell-check
    if: always()
    uses: ./.github/workflows/reusable-workflow-notification.yml
    with:
      success: >-
        ${{
          needs.common.result == 'success' &&
          needs.test-latest-deps.result == 'success' &&
          needs.muzzle.result == 'success' &&
          needs.markdown-link-check.result == 'success' &&
          needs.misspell-check.result == 'success'
        }}
