Check Links #64
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 Links | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "0 8 * * 1" | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| linkcheck: | |
| name: Check links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Lychee link checker | |
| id: lychee | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| args: >- | |
| --verbose | |
| --no-progress | |
| --accept 200,204,206,301,302,403,429 | |
| --timeout 30 | |
| --max-retries 3 | |
| '*.md' | |
| output: lychee/out.md | |
| fail: true | |
| - name: Create or update issue on broken links | |
| if: failure() && github.event_name == 'schedule' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh label create "broken-links" --description "Automated broken link detection" --color "d73a4a" 2>/dev/null || true | |
| existing=$(gh issue list --label "broken-links" --state open --json number --jq '.[0].number // empty') | |
| if [ -n "$existing" ]; then | |
| gh issue comment "$existing" --body-file lychee/out.md | |
| else | |
| gh issue create \ | |
| --title "Broken links detected by scheduled check" \ | |
| --body-file lychee/out.md \ | |
| --label "broken-links" | |
| fi |