-
Notifications
You must be signed in to change notification settings - Fork 360
75 lines (63 loc) · 2.3 KB
/
check-ui-links.yaml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Check links from the UI
on:
pull_request:
branches:
- master
schedule:
- cron: '0 1 * * *' # once a day at 1 am
jobs:
preview:
name: Check links from UI
runs-on: ubuntu-22.04
steps:
- name: Check-out
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: docs
ruby-version: '3.2'
bundler-cache: true
- name: Build latest
working-directory: docs
run: bundle exec jekyll build --config _config.yml -d _site/ --verbose
- name: Get links to check
id: get-links
run: |
escaped_pwd=$(pwd | sed 's/[\/&]/\\&/g')
echo $pwd
echo $escaped_pwd
ls -l
find webui/src -type f ! -name "*.js" -exec grep -Eo 'href="([^"]*)"' {} \; | \
cut -d'"' -f2 | \
grep -v -e "^/" -e "^#" | \
sed "s/https:\/\/docs.lakefs.io/file:\/\/$escaped_pwd\/docs\/_site/" > /tmp/links_to_check.txt
- name: Check links
id: lychee
uses: lycheeverse/lychee-action@v1.9.0
with:
args: /tmp/links_to_check.txt
fail: false
jobSummary: false
format: markdown
output: /tmp/lychee/results.md
- name: Check Lychee output
run: |
if grep "Errors per input" /tmp/lychee/results.md; then
echo "## 🙀 Outbound links found in the lakeFS UI that are broken" > $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
while IFS= read -r line; do
if [[ $line =~ .*docs/_site(.*)\].* ]]; then
search_phrase="${BASH_REMATCH[1]}"
matching_files=$(grep -lr "$search_phrase" "webui/src")
echo "* 🚨 Broken reference to \`$search_phrase\` found in \`$matching_files\`" >> $GITHUB_STEP_SUMMARY
fi
done < /tmp/lychee/results.md
echo "" >> $GITHUB_STEP_SUMMARY
sed -e '/## Errors per input/,$d' /tmp/lychee/results.md >> $GITHUB_STEP_SUMMARY
cat $GITHUB_STEP_SUMMARY
exit 1
else
echo "## ✅ All outbound links found in the lakeFS UI are working" > $GITHUB_STEP_SUMMARY
exit 0
fi