File tree Expand file tree Collapse file tree 2 files changed +45
-8
lines changed Expand file tree Collapse file tree 2 files changed +45
-8
lines changed Original file line number Diff line number Diff line change 22
33set -e
44
5+ IGNORE_FILES=" "
6+ IGNORE_PATTERNS=" "
7+
8+ while getopts " :f:d:p:" opt; do
9+ case " ${opt} " in
10+ f)
11+ IGNORE_FILES=" ${OPTARG} " ;;
12+ d)
13+ IGNORE_DIRS=" ${OPTARG} " ;;
14+ p)
15+ IGNORE_PATTERNS=" ${OPTARG} " ;;
16+ \? )
17+ echo " Invalid option -$OPTARG "
18+ exit ;;
19+ esac
20+ done
21+
22+ read -r -a ignore_files <<< " $IGNORE_FILES"
23+ read -r -a ignore_dirs <<< " $IGNORE_DIRS"
24+ read -r -a ignore_patterns <<< " $IGNORE_PATTERNS"
25+
26+ IGNORE_FILES_ARG=" "
27+ for item in " ${! ignore_files[@]} " ; do
28+ IGNORE_FILES_ARG=" $IGNORE_FILES_ARG --exclude=$item "
29+ done
30+ IGNORE_DIRS_ARG=" "
31+ for item in " ${! ignore_dirs[@]} " ; do
32+ IGNORE_DIRS_ARG=" $IGNORE_DIRS_ARG --exclude-dir=$item "
33+ done
34+
535# 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_@?^=%&\/~+#-])?" " $@ " )
36+ urls=$( grep -oP ' (http|ftp|https):\/\/([a-zA-Z0-9_-]+(?:(?:\.[a-zA-Z0-9_-]+)+))([a-zA-Z0-9_.,@?^=%&:\/~+#-]*[a-zA-Z0-9_@?^=%&\/~+#-])?' -rI $IGNORE_FILES_ARG $IGNORE_DIRS_ARG )
737
838fail_counter=0
939
1040FAILED_LINKS=()
1141for item in $urls ; do
1242# echo $item
43+ skip=0
44+ for pattern in " ${! ignore_patterns[@]} " ; do
45+ [[ " $item " =~ $pattern ]] && skip=1
46+ done
47+
48+ if [[ $skip == 1 ]]; then
49+ echo " SKIPPING $item "
50+ continue
51+ fi
52+
1353 filename=$( echo " $item " | cut -d' :' -f1)
1454 url=$( echo " $item " | cut -d' :' -f2-)
1555 echo -n " Checking $url from file $filename "
Original file line number Diff line number Diff line change 1313 - uses : actions/checkout@v2
1414 - name : Check URLs
1515 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 \
16+ .github/helpers/check_urls.sh \
17+ -d ".git build CMakeModules debian" \
18+ -f "package.xml ursim_docker.rst" \
19+ -p "vnc\.html"
You can’t perform that action at this time.
0 commit comments