Update broken-links.yml #62
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 README for Broken Links | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check-links: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # Step 1: Checkout the repository code | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Step 2: Set up Node.js environment | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| # Step 3: Install the markdown-link-check tool globally | |
| - name: Install markdown-link-check | |
| run: npm install -g markdown-link-check | |
| # Step 4: Check README links and log the results | |
| - name: Check README links | |
| id: check-links | |
| run: | | |
| # Run markdown-link-check and store the results | |
| markdown-link-check --verbose README.md > link-check-results.txt || true | |
| # Output the results for debugging | |
| echo "::group::Link Check Results" | |
| cat link-check-results.txt | |
| echo "::endgroup::" | |
| # Step 5: Analyze and Annotate Results | |
| - name: Annotate Results | |
| run: | | |
| # Extract broken links, excluding any from ./Assets | |
| broken_links=$(grep -B 1 "✖" link-check-results.txt | grep -v "./Assets" || true) | |
| # Count total links and broken links | |
| total_links=$(grep -oE " |