-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: ci run htmlproofer lst * Fix: add status codes * Fix: ruby test * Fix: ruby test * Fix: fetch main branch * Fix: build * FIx: bla * Fix: versions
- Loading branch information
Showing
5 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# CODEOWNERS file sets rules for who should be notified when a pull request | ||
# modifies code in a specific path. | ||
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners for more information. | ||
|
||
# Configuration parameters for site | ||
conf.py @lwasser @kierisi | ||
CNAME @lwasser @kierisi | ||
|
||
# Workflow files for GitHub Actions | ||
.github/** @lwasser @willingc | ||
|
||
# Scripts | ||
scripts/* @lwasser @willingc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require "html-proofer" | ||
require "typhoeus" | ||
|
||
begin | ||
extensions = ['.html'] | ||
directories = ['../_build/html'] | ||
ignore_files = ['./_build/html/_static/webpack-macros.html'] | ||
status_codes = [0, 200, 301, 302, 403, 410, 429, 503, 999] | ||
merge_base = %x(git merge-base origin/main HEAD).chomp | ||
diffable_files = %x(git diff -z --name-only --diff-filter=AC #{merge_base}).split("\0") | ||
diffable_files = diffable_files.select do |filename| | ||
next true if directories.include?(File.dirname(filename)) | ||
|
||
filename.end_with?(".md") | ||
end.map { |f| Regexp.new(File.basename(f, File.extname(f))) } | ||
|
||
# Add urls for it to ignore | ||
diffable_files << %r{^https://fonts\.gstatic\.com.*} | ||
diffable_files << %r{^https://fonts\.googleapis\.com.*} | ||
|
||
# Create a file to capture errors | ||
errors = StringIO.new | ||
HTMLProofer.check_directory( | ||
"./_build/html", | ||
{ | ||
extensions: extensions, | ||
ignore_urls: diffable_files, | ||
ignore_files: ignore_files, | ||
ignore_status_codes: status_codes, | ||
cache: { | ||
timeframe: { | ||
external: "7d", | ||
internal: "7d" | ||
} | ||
}, | ||
typhoeus: { | ||
verbose: false, | ||
ssl_verifyhost: 1 | ||
} | ||
} | ||
).run { |message| errors.puts message } | ||
|
||
# Write errors to a text file | ||
File.write("html_proofer_errors.txt", errors.string) | ||
|
||
rescue StandardError => e | ||
# Print out the error message | ||
puts "An error occurred: #{e.message}" | ||
# Print out backtrace if needed | ||
puts e.backtrace.join("\n") | ||
# Exit with a non-zero status code to indicate failure | ||
exit 1 | ||
end |