Broken links #22
This file contains 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: Broken links | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "23 23 * * 0" | |
permissions: | |
issues: write | |
jobs: | |
link-checker: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: mv .github/.lycheeignore .lycheeignore | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
fail: false # Don't fail on broken links, create an issue instead | |
- name: Find already existing issue | |
id: find-issue | |
run: | | |
echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title \"Link Checker Report\"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Close issue if everything is fine | |
if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != '' | |
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Create Issue From File | |
if: env.lychee_exit_code != 0 | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
issue-number: ${{ steps.find-issue.outputs.number }} | |
title: Link Checker Report | |
content-filepath: ./lychee/out.md | |
labels: bug, automated |