Move docs/src to manuscript (#149) #19
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: Docs Quality Gate | |
| on: | |
| pull_request: | |
| paths: | |
| - "docs/**" | |
| - ".github/**" | |
| - "scripts/**" | |
| - "package.json" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs/**" | |
| - ".github/**" | |
| - "scripts/**" | |
| - "package.json" | |
| workflow_dispatch: {} | |
| jobs: | |
| docs-quality-gate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm ci --no-fund --no-audit | |
| - name: Collect changed Markdown files (docs/) | |
| id: changes | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then | |
| base="${{ github.event.pull_request.base.sha }}" | |
| head="${{ github.event.pull_request.head.sha }}" | |
| else | |
| base="${{ github.event.before }}" | |
| head="${GITHUB_SHA}" | |
| fi | |
| invalid_base=false | |
| if [ -z "${base}" ] || [ "${base}" = "0000000000000000000000000000000000000000" ]; then | |
| invalid_base=true | |
| elif ! git cat-file -e "${base}^{commit}" 2>/dev/null; then | |
| invalid_base=true | |
| fi | |
| if [ "${invalid_base}" = true ]; then | |
| echo "Base SHA is invalid or unavailable; falling back to all tracked docs markdown files." | |
| git ls-files docs | grep -E '\.md$' > changed-docs-md.txt || true | |
| else | |
| # Exclude deleted files (e.g., moves out of docs/) to avoid lint/link-check failures on missing paths. | |
| git diff --name-only --diff-filter=ACMRT "$base" "$head" -- docs | grep -E '\.md$' > changed-docs-md.txt || true | |
| fi | |
| echo "Changed docs markdown files:" | |
| if [ -s changed-docs-md.txt ]; then | |
| cat changed-docs-md.txt | |
| else | |
| echo "(none)" | |
| fi | |
| - name: Markdown lint (changed only) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ ! -s changed-docs-md.txt ]; then | |
| echo "Skip: no docs markdown changes." | |
| exit 0 | |
| fi | |
| cat changed-docs-md.txt | xargs -r npx markdownlint | |
| - name: Internal link check (changed only) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ ! -s changed-docs-md.txt ]; then | |
| echo "Skip: no docs markdown changes." | |
| exit 0 | |
| fi | |
| cat changed-docs-md.txt | xargs -r python3 scripts/check_markdown_internal_links.py |