File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ # Find URLs in code:
6+ urls=$( grep -oP " (http|ftp|https):\/\/([a-zA-Z0-9_-]+(?:(?:\.[a-zA-Z0-9_-]+)+))([a-zA-Z0-9_.,@?^=%&:\/~+#-]*[a-zA-Z0-9_@?^=%&\/~+#-])?" " $@ " )
7+
8+ fail_counter=0
9+
10+ FAILED_LINKS=()
11+ for item in $urls ; do
12+ # echo $item
13+ filename=$( echo " $item " | cut -d' :' -f1)
14+ url=$( echo " $item " | cut -d' :' -f2-)
15+ echo -n " Checking $url from file $filename "
16+ if ! curl --head --silent --fail " $url " 2>&1 > /dev/null; then
17+ echo -e " \033[0;31mNOT FOUND\033[32m\n"
18+ FAILED_LINKS+=(" $url from file $filename " )
19+ (( fail_counter= fail_counter+ 1 ))
20+ else
21+ printf " \033[32mok\033[0m\n"
22+ fi
23+ done
24+
25+ echo " Failed files:"
26+ printf ' %s\n' " ${FAILED_LINKS[@]} "
27+ exit $fail_counter
Original file line number Diff line number Diff line change 1+ name : Check Links
2+ on :
3+ workflow_dispatch :
4+ pull_request :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ check_links :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v2
14+ - name : Check URLs
15+ run : |
16+ .github/helpers/check_urls.sh -rI \
17+ --exclude-dir=.git \
18+ --exclude-dir=build/ \
19+ --exclude=package.xml \
20+ --exclude-dir=CMakeModules \
21+ --exclude-dir=debian \
22+ --exclude=ursim_docker.rst \
You can’t perform that action at this time.
0 commit comments