Check all links in the repository #2047
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 all links in the repository | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| deployment_status: | |
| workflow_dispatch: | |
| jobs: | |
| check: | |
| name: Check all links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Restore lychee cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ github.sha }} | |
| restore-keys: cache-lychee- | |
| - name: Run Lychee | |
| id: lychee | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| args: >- | |
| --verbose --no-progress --max-concurrency 8 --retry-wait-time 20 | |
| --cache --max-cache-age 2d --base-url ${{ | |
| github.event.deployment.payload.web_url || 'https://doc.dvc.org' }} | |
| '.github/**/*' 'content/**/*' 'src/**/*' | |
| fail: true | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| - name: Find latest open Link Check issue | |
| if: github.event != 'deployment_status' | |
| id: find-existing-comment | |
| run: | | |
| gh issue list -R ${{ github.repository }} --author "github-actions[bot]" -l "link-check-all" --json "number" --jq ".[].number" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create or Update Issue | |
| uses: peter-evans/create-issue-from-file@v6 | |
| if: steps.lychee.outputs.exit_code != 0 | |
| with: | |
| issue-number: ${{ steps.find-existing-comment.outputs.result }} | |
| title: 'DVC Download Link Checker Report' | |
| content-filepath: ./lychee/out.md | |
| labels: link-check-all | |
| - name: Close if Check Passes | |
| if: >- | |
| steps.lychee.outputs.exit_code == 0 && | |
| steps.find-existing-comment.outputs.result | |
| run: | |
| gh issue close --comment "The most recent link check passed!" "${{ | |
| steps.find-existing-comment.outputs.result }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |