Update select-into-outfile #39
Workflow file for this run
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: Check Dead Links | |
| on: | |
| pull_request: | |
| paths: | |
| - 'docs/**/*.md' | |
| workflow_dispatch: | |
| jobs: | |
| check-links: | |
| name: Dead Link Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.15.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| cache-dependency-path: 'pnpm-lock.yaml' | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v44 | |
| with: | |
| files: | | |
| docs/**/*.md | |
| - name: Check dead links in changed files | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: | | |
| echo "π Checking dead links in changed markdown files..." | |
| echo "============================================================" | |
| INTERNAL_FAILED=0 | |
| EXTERNAL_WARNINGS=0 | |
| for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
| echo "" | |
| echo "π Checking: $file" | |
| echo "------------------------------------------------------------" | |
| # Run link check and capture output | |
| OUTPUT=$(npx markdown-link-check -c .markdown-link-check.json "$file" 2>&1) || true | |
| echo "$OUTPUT" | |
| # Check for dead internal links (relative paths like ./ or ../) | |
| if echo "$OUTPUT" | grep -E "^\s*\[β\].*\.(\.\/|\.\.\/|[^h][^t][^t][^p])" | grep -v "^http" > /dev/null 2>&1; then | |
| INTERNAL_FAILED=1 | |
| fi | |
| # Check for dead internal links (files without http) | |
| if echo "$OUTPUT" | grep -E "^\s*\[β\].*β Status: 400" > /dev/null 2>&1; then | |
| INTERNAL_FAILED=1 | |
| fi | |
| # Count external link warnings | |
| EXT_COUNT=$(echo "$OUTPUT" | grep -c "^\s*\[β\].*https\?://" 2>/dev/null || echo "0") | |
| if [ "$EXT_COUNT" -gt 0 ]; then | |
| EXTERNAL_WARNINGS=$((EXTERNAL_WARNINGS + EXT_COUNT)) | |
| fi | |
| done | |
| echo "" | |
| echo "============================================================" | |
| echo "π Summary:" | |
| if [ $EXTERNAL_WARNINGS -gt 0 ]; then | |
| echo "β οΈ External link warnings: $EXTERNAL_WARNINGS (not blocking)" | |
| fi | |
| if [ $INTERNAL_FAILED -eq 1 ]; then | |
| echo "β Internal dead links found! CI failed." | |
| exit 1 | |
| else | |
| echo "β All internal links are valid!" | |
| fi | |
| - name: No files to check | |
| if: steps.changed-files.outputs.any_changed != 'true' | |
| run: echo "π No markdown files changed, skipping link check." |