Skip to content

Commit

Permalink
[CI] Fix link checking for all builds (#5551)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Nov 7, 2024
1 parent 9dfa389 commit d619b83
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ CheckMailto: false
TestFilesConcurrently: true
IgnoreDirs:
# DO NOT EDIT! IgnoreDirs list is auto-generated from markdown file front matter.
# 2024-11-03 The following entry is for `en` pages only. Other locales do
# not currently require it.
- ^blog/(\d+/)?page/\d+
# Ignore blog index pages for all locales and in all blog sections (top-level and years)
- ^(../)?blog/(\d+/)?page/\d+
# TODO drop next line after https://github.com/open-telemetry/opentelemetry.io/issues/5423 is fixed for ja pages:
- ^ja/docs/concepts/instrumentation/libraries/
# TODO drop next line after https://github.com/open-telemetry/opentelemetry.io/issues/5423 is fixed for pt pages:
- ^pt/docs/concepts/instrumentation/libraries/
# DO NOT EDIT! IgnoreDirs list is auto-generated from markdown file front matter.
IgnoreInternalURLs: # list of paths
IgnoreURLs: # list of regexs of paths or URLs to be ignored
- /index.xml$ # Ignore rel="alternative" links to RSS feeds
- ^/api$
- ^((/..)?/docs/languages/\w+|\.\.)/(api|examples|registry)/$
- ^(/..)?/docs/collector/registry/$
Expand Down
6 changes: 3 additions & 3 deletions content/en/blog/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ redirects:
- { from: 'index.xml', to: '2024/index.xml 301!' }
outputs: [HTML, RSS]
htmltest:
# 2024-11-07 DO NOT COPY the following IgnoreDirs to non-en pages because handles all locales.
IgnoreDirs:
# 2024-11-03 The following entry is for `en` pages only. Other locales do
# not currently require it.
- ^blog/(\d+/)?page/\d+
# Ignore blog index pages for all locales and in all blog sections (top-level and years)
- ^(../)?blog/(\d+/)?page/\d+
---
2 changes: 1 addition & 1 deletion layouts/partials/hooks/head-end.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
{{ end -}}
{{ end -}}
{{ end -}}
<link rel="canonical" href="{{ $canonicalURL }}">
<link rel="canonical" href="{{ $canonicalURL }}" data-proofer-ignore>

{{- end -}}
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,14 @@
"log:check:links": "npm run check:links | tee tmp/build-log.txt",
"make:public": "make public ls-public",
"netlify-build:preview": "npm run seq -- build:preview diff:check",
"netlify-build:production": "npm run build:production",
"netlify-build:production": "npm run seq -- build:production diff:check",
"postget:submodule": "git submodule",
"postnetlify-build:production": "git restore .htmltest.yml && npm run diff:check",
"prebuild:preview": "npm run _prebuild",
"prebuild:production": "npm run _prebuild",
"prebuild": "npm run _prebuild",
"precheck:links:internal": "npm run build && npm run update:htmltest-config",
"precheck:links": "npm run build && npm run update:htmltest-config",
"prefix:submodules": "npm run update:submodule",
"prenetlify-build:production": "echo 'IgnoreTagAttribute: rel' >> .htmltest.yml",
"prepare": "npm run seq -- get:submodule _prepare:docsy",
"preserve:hugo": "npm run _prebuild",
"preserve:netlify": "npm run seq -- _prebuild _install:netlify-cli",
Expand Down
9 changes: 5 additions & 4 deletions scripts/htmltest-config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ sub extract_htmltest_config {
return;
}

shift @htmltest_config;
do {
shift @htmltest_config;
} until !@htmltest_config # No more config
|| $htmltest_config[0] !~ /^\s*#/; # Non-comment line

if (@htmltest_config >= 1 && $htmltest_config[0] =~ /^IgnoreDirs:/i) {
return _extract_ignore_dirs($file_path, @htmltest_config)
}
return _extract_ignore_dirs($file_path, @htmltest_config) if $htmltest_config[0] =~ /^IgnoreDirs:/i;

# TODO: Add support for `IgnoreURLs`.

Expand Down

0 comments on commit d619b83

Please sign in to comment.