Skip to content

Commit 0f043f6

Browse files
Merge pull request #30 from gaurav-nelson/array
Maxdepth predicate fix
2 parents 952b059 + 6bd6d09 commit 0f043f6

File tree

6 files changed

+90
-11
lines changed

6 files changed

+90
-11
lines changed

.github/workflows/push.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
on: push
2-
name: New workflow
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
name: Link Check
39
jobs:
410
markdown-link-check:
511
runs-on: ubuntu-latest

entrypoint.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,35 @@ echo -e "${BLUE}USE_VERBOSE_MODE: $2${NC}"
2020
echo -e "${BLUE}FOLDER_PATH: $4${NC}"
2121
echo -e "${BLUE}MAX_DEPTH: $5${NC}"
2222

23-
FIND_CALL="find ${FOLDER_PATH} -name \*.md -not -path './node_modules/*' -exec markdown-link-check {}"
23+
declare -a FIND_CALL
24+
25+
if [ "$5" -ne -1 ]; then
26+
FIND_CALL=('find' "${FOLDER_PATH}" '-name' '*.md' '-not' '-path' './node_modules/*' '-maxdepth' "${MAX_DEPTH}" '-exec' 'markdown-link-check' '{}')
27+
else
28+
FIND_CALL=('find' "${FOLDER_PATH}" '-name' '*.md' '-not' '-path' './node_modules/*' '-exec' 'markdown-link-check' '{}')
29+
fi
2430

2531
if [ -f "$CONFIG_FILE" ]; then
2632
echo -e "${BLUE}Using markdown-link-check configuration file: ${YELLOW}$CONFIG_FILE${NC}"
27-
FIND_CALL+=" --config ${CONFIG_FILE}"
33+
FIND_CALL+=('--config' "${CONFIG_FILE}")
2834
else
2935
echo -e "${BLUE}Cannot find ${YELLOW}$CONFIG_FILE${NC}"
3036
echo -e "${YELLOW}NOTE: See https://github.com/tcort/markdown-link-check#config-file-format to know more about"
3137
echo -e "customizing markdown-link-check by using a configuration file.${NC}"
3238
fi
33-
if [ "$5" -ne -1 ]; then
34-
FIND_CALL+=" --maxdepth ${MAX_DEPTH}"
35-
fi
3639

3740
if [ "$USE_QUIET_MODE" = "yes" ]; then
38-
FIND_CALL+=" -q"
41+
FIND_CALL+=('-q')
3942
fi
4043

4144
if [ "$USE_VERBOSE_MODE" = "yes" ]; then
42-
FIND_CALL+=" -v"
45+
FIND_CALL+=('-v')
4346
fi
4447

45-
FIND_CALL+=" \; &>> error.txt"
48+
FIND_CALL+=(';')
4649

4750
set -x
48-
eval "$FIND_CALL"
51+
"${FIND_CALL[@]}" &>> error.txt
4952
set +x
5053

5154
if [ -e error.txt ] ; then

md/md-level-1/level-1a.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
## Test internal and external links
3+
4+
www.google.com
5+
6+
[This is a broken link](https://www.exampleexample.cox)
7+
8+
[This is another broken link](http://ignored-domain.com) but its ignored using a
9+
configuration file.
10+
11+
### Alpha
12+
13+
This [exists](#alpha).
14+
This [one does not](#does-not).
15+
References and definitions are [checked][alpha] [too][charlie].
16+
17+
### Bravo
18+
19+
Headings in `readme.md` are [not checked](file1.md#bravo).
20+
But [missing files are reported](missing-example.js).
21+
22+
[alpha]: #alpha
23+
[charlie]: #charlie
24+
25+
External file: [Charlie](./file2.md/#charlie)

md/md-level-1/level-1b.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Checking more links
2+
3+
## Bravo
4+
5+
This [doesn't exists](#alpha).
6+
This [one does](#bravo).
7+
8+
## Charlie
9+
10+
This is linked from file1.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
## Test internal and external links
3+
4+
www.google.com
5+
6+
[This is a broken link](https://www.exampleexample.cox)
7+
8+
[This is another broken link](http://ignored-domain.com) but its ignored using a
9+
configuration file.
10+
11+
### Alpha
12+
13+
This [exists](#alpha).
14+
This [one does not](#does-not).
15+
References and definitions are [checked][alpha] [too][charlie].
16+
17+
### Bravo
18+
19+
Headings in `readme.md` are [not checked](file1.md#bravo).
20+
But [missing files are reported](missing-example.js).
21+
22+
[alpha]: #alpha
23+
[charlie]: #charlie
24+
25+
External file: [Charlie](./file2.md/#charlie)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Checking more links
2+
3+
## Bravo
4+
5+
This [doesn't exists](#alpha).
6+
This [one does](#bravo).
7+
8+
## Charlie
9+
10+
This is linked from file1.

0 commit comments

Comments
 (0)