forked from devonfw/devonfw.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (31 loc) · 911 Bytes
/
linkchecker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Broken link check
on:
workflow_run:
workflows: ["build-and-deploy"]
types:
- completed
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