File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 74
74
entry : hooks/helmlint.sh
75
75
language : script
76
76
files : \.((ya?ml)|(tpl))$
77
+
78
+ - id : markdown-link-check
79
+ name : markdown-link-check
80
+ description : Run markdown-link-check to check all the relative and absolute links in markdown docs.
81
+ entry : hooks/mdlink-check.sh
82
+ language : script
83
+ files : \.md$
84
+ exclude : vendor\/.*$
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ supported hooks are:
13
13
* ** golint** : Automatically run ` golint ` on all Golang code (` *.go ` files)
14
14
* ** yapf** : Automatically run [ ` yapf ` ] ( https://github.com/google/yapf ) on all python code (` *.py ` files).
15
15
* ** helmlint** Automatically run [ ` helm lint ` ] ( https://github.com/helm/helm/blob/master/docs/helm/helm_lint.md ) on your
16
- helm charts.
16
+ * ** markdown-link-check** Automatically run [ markdown-link-check] ( https://github.com/tcort/markdown-link-check ) on
17
+ markdown doc files.
17
18
18
19
19
20
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ # OSX GUI apps do not pick up environment variables the same way as Terminal apps and there are no easy solutions,
6
+ # especially as Apple changes the GUI app behavior every release (see https://stackoverflow.com/q/135688/483528). As a
7
+ # workaround to allow GitHub Desktop to work, add this (hopefully harmless) setting here.
8
+ export PATH=$PATH :/usr/local/bin
9
+
10
+ if ! command -v markdown-link-check; then
11
+ >&2 echo " markdown-link-check is not available on this system."
12
+ >&2 echo " Please install it by running 'npm install -g markdown-link-check'"
13
+ exit 1
14
+ fi
15
+
16
+ # This is the recommended way to set the project root for properly resolving absolute paths. See
17
+ # https://github.com/tcort/markdown-link-check/issues/16 for more info.
18
+ TMP_CONFIG=" $( mktemp) "
19
+ cat > " $TMP_CONFIG " << EOF
20
+ {
21
+ "replacementPatterns": [
22
+ {
23
+ "pattern": "^/",
24
+ "replacement": "file://$( pwd) /"
25
+ }
26
+ ]
27
+ }
28
+ EOF
29
+
30
+ for file in " $@ " ; do
31
+ markdown-link-check -c " $TMP_CONFIG " " $file "
32
+ done
You can’t perform that action at this time.
0 commit comments