Skip to content

Commit 7415d3d

Browse files
chore: update HTML verification workflow and add configuration file (#477)
On-behalf-of: Gerald Morrison (SAP) <[email protected]> <!-- markdownlint-disable MD041 --> #### What this PR does / why we need it Use new HTML (link) checker. It checks internal and external links. ## What issue is fixed? fixes open-component-model/ocm-project/issues/498 Signed-off-by: Gerald Morrison (SAP) <[email protected]> Co-authored-by: Gerald Morrison (SAP) <[email protected]>
1 parent 8651501 commit 7415d3d

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

.github/config/htmltest.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# HTMLTest option reference: https://github.com/wjdp/htmltest?tab=readme-ov-file#basic-options
2+
3+
# Directory for HTMLTest to scan
4+
DirectoryPath: ./public
5+
6+
# Checks to ignore
7+
CheckInternalHash: false
8+
CheckDoctype: false
9+
IgnoreInternalEmptyHash: true
10+
IgnoreAltMissing: true
11+
IgnoreEmptyHref: true
12+
IgnoreDirectoryMissingTrailingSlash: true
13+
14+
# Avoid HTTP 403 Errors (on corporate pages): Override User-Agent and referer
15+
HTTPHeaders:
16+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
17+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
18+
"Accept-Language": "en-US,en;q=0.9"
19+
"Referer": "https://ocm.software"
20+
ExternalTimeout: 10
21+
22+
# URLs to ignore
23+
IgnoreURLs:
24+
# Skip all SAP legal pages (appears in footer, so on every page)
25+
- "^https://www\\.sap\\.com/.*/legal/.*"
26+
- "^mailto:"
27+
# Skip local pages from secure delivery demo
28+
- "^https?://(www\\.)?gitea\\.ocm\\.dev(/|$)"
29+
- "^https://.*\\.ocm\\.dev(/|$)"
30+
# Skip Google calendar entries
31+
- "^https://calendar\\.google\\.com(/|$)"

.github/workflows/verify-html.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
name: Verify HTML
1+
# This workflow verifies that all links in the HTML files are valid.
2+
# GitHub repo: https://github.com/wjdp/htmltest
3+
4+
name: Verify HTML Links
25

36
on:
47
pull_request:
@@ -10,19 +13,25 @@ permissions:
1013

1114
jobs:
1215
check-links:
13-
name: Check links
16+
name: Check external and internal links
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/checkout@v4
20+
1721
- name: Setup Node.js
1822
uses: actions/setup-node@v4
1923
with:
2024
node-version: 22.12.0 # keep in sync with 'engines'@package.json
25+
2126
- name: Install Dependencies
2227
run: npm install
28+
2329
- name: Build Site
2430
run: npm run build
31+
2532
- name: Verify HTML links
26-
uses: untitaker/[email protected]
27-
with:
28-
args: public/ --sources content/
33+
# Download binary to ./bin. Execute it with log level 1 (INFO) and config file
34+
run: |
35+
curl https://htmltest.wjdp.uk | bash
36+
chmod +x ./bin/htmltest
37+
./bin/htmltest -l 1 -c .github/config/htmltest.yml

0 commit comments

Comments
 (0)