Skip to content

Commit

Permalink
Switched link checker to HTML proofer.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmundra committed Feb 22, 2024
1 parent 878bc52 commit 8fc1987
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This action reminds users to add a meaningful alternative text to their images.

## link-check.yml

This action checks all markdown links for issues.
This action checks content links for issues using https://github.com/gjtorikian/html-proofer.

# References

Expand All @@ -54,12 +54,12 @@ This action checks all markdown links for issues.
* https://engineering.18f.gov/accessibility-scanning/
* https://medium.com/@f3igao/how-to-automate-web-accessibility-testing-921512bdd4bf
* https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f
* https://docs.gitlab.com/ee/user/project/merge_requests/accessibility_testing.html
* https://stackoverflow.com/questions/57915432/write-output-of-npm-run-start-to-a-file
* https://github.com/marketplace/actions/comment-pull-request
* https://pre-commit.com/
* https://github.blog/2021-04-28-use-github-actions-manage-docs/
* https://stackoverflow.com/questions/62325286/run-github-actions-when-pull-requests-have-a-specific-label
* https://github.com/marketplace/actions/push-directory-to-another-repository
* https://github.com/marketplace/actions/find-and-replace
* https://github.com/marketplace/actions/publish-unit-test-results
* https://github.com/gjtorikian/html-proofer
* https://danielsieger.com/blog/2021/03/28/check-broken-links-jekyll.html
22 changes: 16 additions & 6 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ on:
pull_request:

jobs:
markdown-link-check:
build:
name: Building site and running HTML proofer
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1
- name: Checkout source.
uses: actions/checkout@v2

- name: Install jekyll site dependencies.
uses: ruby/setup-ruby@v1
with:
config-file: "markdown.links.config.json"
use-quiet-mode: "yes"
use-verbose-mode: "yes"
ruby-version: 2.6
bundler-cache: true

- name: Build site
run: npm run build

- name: Run HTML proofer.
run: npm run link-checker
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ group :jekyll_plugins do
gem 'jekyll-redirect-from'
gem 'jekyll-feed'
end

gem 'html-proofer'
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ GEM
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
ffi (1.15.5)
forwardable-extended (2.6.0)
html-proofer (4.4.3)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogiri (~> 1.13)
parallel (~> 1.10)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
zeitwerk (~> 2.5)
http_parser.rb (0.8.0)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -51,10 +62,17 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.8.5)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
parallel (1.24.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
posix-spawn (0.3.15)
public_suffix (4.0.7)
racc (1.7.3)
rainbow (3.1.1)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand All @@ -65,12 +83,17 @@ GEM
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
unicode-display_width (1.8.0)
yell (2.2.2)
zeitwerk (2.6.13)

PLATFORMS
ruby

DEPENDENCIES
html-proofer
jekyll-feed
jekyll-last-modified-at
jekyll-redirect-from
Expand Down
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ exclude:
- .gitlab-ci.yml
- public
- medium-posts-script
- markdown.links.config.json
80 changes: 0 additions & 80 deletions markdown.links.config.json

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
"license": "Creative Commons Attribution-ShareAlike 4.0 International Public License",
"scripts": {
"postinstall": "bundle",
"build": "bundle exec jekyll build",
"start": "bundle exec jekyll serve",
"start-detached": "bundle exec jekyll serve --detach",
"setup-uswds": "npm run sync-assets && npm run sync-sass",
"sync-assets": "rsync -avr --delete node_modules/uswds/dist/ assets/uswds/ --exclude=/*.md --exclude=/*.zip --exclude=/css --exclude=/scss",
"sync-sass": "rsync -avr --delete node_modules/uswds/src/stylesheets/ _sass/uswds/src/",
"pa11y-ci:home": "pa11y-ci http://127.0.0.1:4000",
"pa11y-ci:sitemap": "pa11y-ci --sitemap http://127.0.0.1:4000/sitemap.xml --sitemap-find https://accessibility.civicactions.com --sitemap-replace http://127.0.0.1:4000 --sitemap-exclude \"/*.pdf\"",
"cypress-tests": "cypress run --browser chrome --headless"
"cypress-tests": "cypress run --browser chrome --headless",
"link-checker": "bundle exec htmlproofer --ignore-status-codes \"999,403,0\" --ignore-urls \"/fonts.gstatic.com/\" --enforce_https \"false\" ./_site"
},
"dependencies": {
"simple-jekyll-search": "^1.9.2"
Expand Down

0 comments on commit 8fc1987

Please sign in to comment.