name: Spellcheck Action
on: push

jobs:
  build:
    name: Spellcheck
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

    - name: Get all changed markdown files
      uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45
      id: changed_files
      with:
        files: |
           **.md

    - name: Run Spellcheck
      id: spellcheck
      uses: rojopolis/spellcheck-github-actions@v0
      with:
        task_name: Markdown
        source_files: ${{ steps.changed_files.outputs.all_changed_files }}
        output_file: spellcheck-output.txt

    - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
      if: '!cancelled()'
      with:
        name: Spellcheck Output
        path: spellcheck-output.txt