File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change 3939
4040 - name : Start Hugo server
4141 run : |
42- nohup hugo server -p 1313 &
43- sleep 5 # Wait for server to start
42+ hugo server --port 1313 >/dev/null 2>&1 &
43+ until curl -fs http://localhost:1313/ >/dev/null 2>&1; do
44+ sleep 0.2
45+ done
46+ echo "Hugo is ready"
4447
4548 - name : Check internal links
4649 id : linkcheck
@@ -50,18 +53,25 @@ jobs:
5053 /BROKEN/ { cluster=cluster $0 "\n"; next }
5154 /^Finished!/ { if(cluster) { printf "%s\n%s\n", header, cluster } }
5255 ')
53- echo ""
54- echo "$broken"
56+
57+ printf "%s\n" "$broken"
58+
5559 echo "broken<<EOF" >> $GITHUB_ENV
5660 echo "$broken" >> $GITHUB_ENV
5761 echo "EOF" >> $GITHUB_ENV
5862
59- - name : Stop Hugo server
60- run : |
61- pkill -f "hugo server"
63+ if [ -n "$broken" ]; then
64+ echo "Broken internal links detected"
65+ exit 1
66+ fi
6267
6368 - name : Suggestions
64- if : env.broken != ''
69+ if : failure()
6570 run : |
6671 echo -e "\nPlease review the links reported in Check internal links step above.\n"
6772 exit 1
73+
74+ - name : Stop Hugo server
75+ if : always()
76+ run : |
77+ pkill -f "hugo server"
You can’t perform that action at this time.
0 commit comments