-
Notifications
You must be signed in to change notification settings - Fork 2.8k
62 lines (59 loc) · 2.16 KB
/
Copy pathdocs.yml
File metadata and controls
62 lines (59 loc) · 2.16 KB
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
name: docs
on:
push:
branches-ignore:
- 'dependabot/**'
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
pull_request:
branches:
- master
- 'branch-*'
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
permissions:
contents: read
jobs:
internal-link-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
working-directory: docs
- name: Build the Jekyll site
working-directory: docs
run: bundle exec jekyll build --safe -d _site
- name: Check internal links
working-directory: docs
# Report-only: broken links are printed in the log but do not fail the
# build yet. Remove this once the job has been green for a while, so
# that broken links start blocking merges (ZEPPELIN-6628).
continue-on-error: true
run: |
gem install html-proofer -v 5.2.2 --no-document
# Template links are prefixed with JB.BASE_PATH (e.g.
# /docs/0.13.0-SNAPSHOT), a prefix that only exists once the site is
# published. Strip it so links resolve against the built tree. Read it
# from _config.yml so a version bump does not break this job.
BASE_PATH=$(ruby -ryaml -e 'puts(YAML.load_file("_config.yml")["JB"]["BASE_PATH"] || "")')
echo "Stripping BASE_PATH prefix: ${BASE_PATH}"
# Only internal links are in scope. External URLs are skipped because
# they break for reasons outside this repository and would make the
# job flaky; anchor fragments are skipped for the same reason. The
# --allow-missing-href flag keeps `<a name="...">` anchors, which the
# docs use as link targets, from being reported as errors.
htmlproofer _site \
--root-dir _site \
--checks Links \
--disable-external \
--no-enforce-https \
--no-check-internal-hash \
--allow-missing-href \
--swap-urls "^${BASE_PATH}:"