ci: add link checker #7
Workflow file for this run
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: Links | |
| on: | |
| repository_dispatch: | |
| workflow_dispatch: | |
| pull_request: | |
| schedule: | |
| - cron: "00 18 * * *" | |
| jobs: | |
| linkChecker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write # required for peter-evans/create-issue-from-file | |
| pull-requests: write # required for peter-evans/create-or-update-comment | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Link Checker | |
| id: lychee | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| fail: false | |
| - name: Prepare PR Comment | |
| if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'pull_request' | |
| run: | | |
| if [ -f ./lychee/out.md ]; then | |
| cp ./lychee/out.md ./pr-comment.md | |
| else | |
| echo "## 🔗 Link Checker Report" > ./pr-comment.md | |
| echo "" >> ./pr-comment.md | |
| echo "The link checker found broken links in this pull request. Please check the workflow logs for details." >> ./pr-comment.md | |
| fi | |
| - name: Create or Update PR Comment | |
| if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'pull_request' | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body-path: ./pr-comment.md | |
| edit-mode: replace | |
| comment-id: link-checker-report | |
| - name: Create Issue From File | |
| if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'schedule' | |
| uses: peter-evans/create-issue-from-file@v5 | |
| with: | |
| title: Link Checker Report | |
| content-filepath: ./lychee/out.md | |
| labels: 'type: documentation' |