dispatch-website-linkcheck #746
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 link check | |
on: | |
repository_dispatch: | |
types: [dispatch-website-linkcheck] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: update | |
run: sudo apt-get update | |
- name: check if apt can find linkchecker | |
run: sudo apt-cache search linkchecker | |
- name: install linkchecker | |
run: sudo apt-get install w3c-linkchecker | |
- name: start check | |
run: | | |
checklink -r -s -b https://devonfw.com | tee output.txt | |
- name: parse check output | |
run: | | |
output=$(cat output.txt) | |
if [[ $output == *"Code: 404 Not Found"* ]]; then | |
echo "Broken link" | |
exit 1 | |
fi | |
if [[ $output == *"To do: Some of the links to this resource point to broken URI fragments"* ]]; then | |
echo "Broken fragment" | |
exit 2 | |
fi |