forked from marccampbell/hugo-linkcheck-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·47 lines (34 loc) · 1.19 KB
/
entrypoint.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash -x
# Install Hugo
VER="${HUGO_VERSION:-0.85.0}"
mkdir /tmp/hugos
pushd /tmp/hugos
wget https://github.com/gohugoio/hugo/releases/download/v${VER}/hugo_extended_${VER}_Linux-64bit.tar.gz
tar xzvf /tmp/hugos/hugo_extended_${VER}_Linux-64bit.tar.gz
cp hugo /usr/local/bin/hugo
rm -rf *
popd
WORKDIR="${GITHUB_WORKSPACE:-/github/workspace}"
# Fix ownership on workdir so Git log can be read
chown -R $(id -u):$(id -g) $WORKDIR
# Use the hugo serve command to create a website that will be used for link checking
pushd ${WORKDIR}/${HUGO_ROOT}
hugo serve --baseUrl http://localhost:1313 --contentDir ${WORKDIR}/${HUGO_CONTENT_ROOT} &
HUGO_PID=$!
popd
# Give hugo some time to start.
sleep $HUGO_STARTUP_WAIT
# If hugo has failed, report it as a comment (if comments are enabled)
# if [ -n "$PID" -a -e /proc/$PID ]; then
# # Hugo started
# else
# exit 1
# fi
COMMENT="#### \`hugo serve\` Failed"
# for exclusion in $(cat $HUGO_EXCLUSION_LIST)
# do
# exclusionarg=$exclusionarg" --exclude $exclusion "
# done
node --no-deprecation /action/build/hugo-linkcheck-action.js scan --url http://localhost:1313 --exclude-file /github/workspace/${HUGO_EXCLUSIONS_LIST}
# Kill the hugo serve
kill $HUGO_PID