del entry #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Markdown CI | |
| on: | |
| pull_request: # run on all PRs | |
| push: | |
| branches: [ main ] # run on main after merges (format + commit) | |
| workflow_dispatch: | |
| concurrency: | |
| group: markdown-ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pr-checks: | |
| if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write # needed for PR comments | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install formatting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Check content quality | |
| uses: DavidAnson/markdownlint-cli2-action@v18 | |
| with: | |
| globs: "**/*.md" | |
| - name: Check if formatting is needed | |
| id: format_check | |
| continue-on-error: true | |
| run: | | |
| mdformat . --wrap 88 --check | |
| echo "format_needed=$?" >> $GITHUB_OUTPUT | |
| - name: Comment on formatting if needed | |
| if: steps.format_check.outputs.format_needed != '0' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const comment = `## Formatting Notice | |
| Your contribution looks great! Our automated formatting will clean up any spacing or line-wrapping issues when your PR is merged. | |
| **What this means:** | |
| - Your content and links are fine | |
| - Some line lengths or spacing will be adjusted automatically | |
| - No action needed from you | |
| Thanks for contributing to the citizen science community!`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); | |
| main-format: | |
| if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && | |
| github.ref == 'refs/heads/main' && | |
| github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install formatting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Auto-format all markdown files | |
| run: mdformat . --wrap 88 | |
| - name: Commit formatting improvements | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "style: auto-format markdown files for consistency" | |
| file_pattern: "**/*.md" | |
| - name: Final content quality check | |
| uses: DavidAnson/markdownlint-cli2-action@v18 | |
| with: | |
| globs: "**/*.md" |