Link Checker #335
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: Link Checker | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
linkChecker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Link Checker | |
uses: lycheeverse/lychee-action@v1.7.0 | |
id: lychee | |
env: | |
GITHUB_TOKEN: ${{secrets.TOKEN_GITHUB}} | |
- name: Count broken links | |
run: | | |
broken_max=10 | |
broken_count=$(printf "%d" $(grep "🚫 Errors" lychee/out.md | cut -d'|' -f3)) | |
if [ "$broken_count" -gt "$broken_max" ]; then | |
echo "Number of broken links (${broken_count}) exceeds maximum allowed number (${broken_max})." | |
cat lychee/out.md | |
exit 1 | |
else | |
echo "Number of broken links (${broken_count}) less than or equal to maximum allowed number (${broken_max})." | |
exit 0 | |
fi |