Check external links #80
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 external links | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - ".github/workflows/links.yml" | |
| - "lychee-external-links.toml" | |
| schedule: | |
| - cron: "0 3 1 * *" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| lint: | |
| name: links-check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Get Current Date | |
| id: dateofday | |
| run: echo "DATEOFDAY=$(date +%Y-%m-%d)" >> "$GITHUB_ENV" | |
| - name: Restore lychee cache | |
| id: cache-restore | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ env.DATEOFDAY }} | |
| restore-keys: | | |
| cache-lychee- | |
| - name: Link Checker | |
| uses: lycheeverse/lychee-action@v2.8.0 | |
| id: link-checker | |
| with: | |
| fail: false | |
| failIfEmpty: false | |
| args: --config ./lychee-external-links.toml --no-progress 'docs/**/*.md' 'versioned_docs/**/*.md' | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Save lychee cache | |
| if: always() | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ env.DATEOFDAY }} | |
| - name: Fail if checker failed in non-schedule trigger mode | |
| if: github.event_name != 'schedule' && steps.link-checker.outputs.exit_code != 0 | |
| run: | | |
| echo "Link checker failed with exit code ${{ steps.link-checker.outputs.exit_code }}" | |
| exit 1 | |
| - name: Create Issue From File | |
| if: ${{ failure() && github.event_name == 'schedule' && steps.link-checker.outputs.exit_code != 0 }} | |
| uses: peter-evans/create-issue-from-file@v6 | |
| with: | |
| title: Link Checker Report | |
| content-filepath: ./lychee/out.md | |
| labels: report, automated issue, kind/bug, dx |