Skip to content

Commit

Permalink
Added link checker. (#732)
Browse files Browse the repository at this point in the history
* Added link checker.

* Updating path of markdown.links.config.json

* Ignoring markdown links config file.

* Switched link checker to HTML proofer.

* Ignoring 302 codes and fixing a few links.
  • Loading branch information
dmundra authored Feb 26, 2024
1 parent 339550c commit 302fd88
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Run a11ywatch GitHub action to check accessibility of the site.

This action reminds users to add a meaningful alternative text to their images.

## link-check.yml

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

# References

* https://github.com/pa11y/pa11y
Expand All @@ -50,12 +54,12 @@ This action reminds users to add a meaningful alternative text to their images.
* 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
28 changes: 28 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Checking links

on:
# Automatic check weekly
schedule:
- cron: "0 9 * * 1"
pull_request:

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

steps:
- name: Checkout source.
uses: actions/checkout@v2

- name: Install jekyll site dependencies.
uses: ruby/setup-ruby@v1
with:
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 _guide/champions-program.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ Many joined CivicActions because they wanted to work for an impact-driven organi
* [LinkedIN's Program](https://engineering.linkedin.com/blog/2019/05/scaling-accessibility-through-a11y-champions-program)
* Intuit (Quickbooks)
* [The A11y Global Collective: Scaling Accessibility — Intuit's Accessibility Champions Program (YouTube)](https://www.youtube.com/watch?v=np6sIWUTPlE)
* [The A11y Global Collective: Scaling Accessibility — Intuit's Accessibility Champions Program Slides (PDF)](http://www.last-child.com/wp-content/uploads/2021/09/Accessibility-Champions.pdf)
* [Intuit's Accessibility Champion Program](https://www.last-child.com/intuits-accessibility-champion-program/)
* [Lessons Learned from an Intuit Accessibility Champion (Blog)](https://www.intuit.com/blog/innovation/lessons-learned-from-an-intuit-accessibility-champion/)
* AbilityNet
Expand Down
2 changes: 1 addition & 1 deletion _guide/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Evaluate WAI-ARIA according to the [ARIA in HTML](https://www.w3.org/TR/html-ari
### Web based contrast tools

* [Contrast Finder by Tanaguru](https://contrast-finder.tanaguru.com/) - [Contrast Finder GitHub Page](https://github.com/Tanaguru/Contrast-Finder)
* [Contrast-Ratio.com](https://contrast-Ratio.com) - [Contrast-Ratio GitHub Page]([https://github.com/LeaVerou/contrast-ratio](https://github.com/siege-media/contrast-ratio)) \
* [Contrast-Ratio.com](https://contrast-Ratio.com) - [Contrast-Ratio GitHub Page](https://github.com/siege-media/contrast-ratio) \
Allows for testing of contrast of text on top of a semi transparent background.
* [Contrast Checker](https://contrast-checker.glitch.me/) - [Contrast Checker on Glitch](https://glitch.com/edit/#!/contrast-checker?path=server.js%3A1%3A0)
* [ButtonBuddy](https://buttonbuddy.dev/) - [ButtonBuddy on GitHub](https://github.com/5t3ph/buttonbuddy)
Expand Down
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,302,0\" --ignore-urls \"/fonts.gstatic.com/\" --enforce_https \"false\" ./_site"
},
"dependencies": {
"simple-jekyll-search": "^1.9.2"
Expand Down

0 comments on commit 302fd88

Please sign in to comment.