name: Markdown

on:
  repository_dispatch:
  workflow_dispatch:
  schedule:
  # Everyday at 9:00 AM.
  - cron: "0 9 * * *"

jobs:
  lint-markdown:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Repo
      uses: actions/checkout@v4

    - name: Run linter
      id: markdownlint
      uses: docker://avtodev/markdown-lint:v1
      with:
        config: .markdownlint.yaml
        args: '**/*.md'
        output: ./markdownlint.txt

    - name: Create Issue From File
      if: steps.markdownlint.outputs.exit_code != 0
      uses: peter-evans/create-issue-from-file@v5
      with:
        title: Markdown Lint Report
        content-filepath: ./markdownlint.txt
        labels: report, bot-generated
