Add workflow for checking broken links / Create broken-links.yml #1
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 | |
| pull_request: | |
| jobs: | |
| check-links: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Install markdown-link-check | |
| run: npm install -g markdown-link-check | |
| - name: Check README links | |
| id: check-links | |
| run: | | |
| markdown-link-check README.md > link-check-results.txt || exit 1 | |
| continue-on-error: true | |
| - name: Handle Results | |
| if: success() || failure() | |
| run: | | |
| if grep -q "ERROR" link-check-results.txt; then | |
| echo "::error::Broken links found in README:" | |
| cat link-check-results.txt | |
| exit 1 | |
| else | |
| echo "::notice::No broken links found!" | |
| fi |