From 3f88c01a950c6fed9cb23a7543885a9cc8774371 Mon Sep 17 00:00:00 2001 From: Daniel Mundra Date: Thu, 22 Feb 2024 14:45:14 -0800 Subject: [PATCH 1/5] Added link checker. --- .github/workflows/README.md | 4 ++ .github/workflows/link-check.yml | 18 +++++++ markdown.links.config.json | 80 ++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 .github/workflows/link-check.yml create mode 100644 markdown.links.config.json diff --git a/.github/workflows/README.md b/.github/workflows/README.md index e2745016..eeee0304 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -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 all markdown links for issues. + # References * https://github.com/pa11y/pa11y diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 00000000..869dad43 --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,18 @@ +name: Checking links + +on: + # Automatic check weekly + schedule: + - cron: "0 9 * * 1" + pull_request: + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: ".config/markdown.links.config.json" + use-quiet-mode: "yes" + use-verbose-mode: "yes" diff --git a/markdown.links.config.json b/markdown.links.config.json new file mode 100644 index 00000000..75fae4d5 --- /dev/null +++ b/markdown.links.config.json @@ -0,0 +1,80 @@ +{ + "ignorePatterns": [ + { + "NOTE: Authenticated sites below": "", + "pattern": "^https://github.com/settings/two_factor_authentication/configure$" + }, + { + "pattern": "^https://docs.google.com/.*" + }, + { + "pattern": "^http://ci.civicactions.net/$" + }, + { + "pattern": "^https://app.skills-base.com/.*" + }, + { + "pattern": "^https://app.statuscake.com/.*" + }, + { + "pattern": "^https://docs.google.com/.*" + }, + { + "pattern": "^https://www.linkedin.com/company/civicactions/$" + }, + { + "NOTE: Sites with captcha protection below": "", + "pattern": "^https://.*drupal.org/.*" + }, + { + "pattern": "^https://.*.lastpass.com/.*" + }, + { + "pattern": "^https://twitter.com/.*" + }, + { + "pattern": "^https://support.yubico.com/.*" + }, + { + "pattern": "^https://.*.zendesk.com/.*" + }, + { + "pattern": "^https://support.zoom.us/.*" + }, + { + "pattern": "^https://identity.trinet.com/.*" + }, + { + "pattern": "^https://.*.ecosia.org/.*" + }, + { + "NOTE: Unreliable sites below": "", + "pattern": "^https://nedjo.ca/.*" + }, + { + "pattern": "^http://linux.die.net/.*" + }, + { + "pattern": "^https://linux.die.net/.*" + }, + { + "pattern": "^https://duckduckgo.com/.*" + }, + { + "pattern": "^https://askubuntu.com/.*" + } + ], + "httpHeaders": [ + { + "urls": [ + "https://github.com/", + "https://guides.github.com/", + "https://help.github.com/", + "https://docs.github.com/" + ], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + } + ] +} From d4d247d02aa983272eddc92f4266cd720f8aca8f Mon Sep 17 00:00:00 2001 From: Daniel Mundra Date: Thu, 22 Feb 2024 14:48:10 -0800 Subject: [PATCH 2/5] Updating path of markdown.links.config.json --- .github/workflows/link-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index 869dad43..13e38304 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -13,6 +13,6 @@ jobs: - uses: actions/checkout@v4 - uses: gaurav-nelson/github-action-markdown-link-check@v1 with: - config-file: ".config/markdown.links.config.json" + config-file: "markdown.links.config.json" use-quiet-mode: "yes" use-verbose-mode: "yes" From 878bc52917d5287b590cb3d7c174e14b0f27ae54 Mon Sep 17 00:00:00 2001 From: Daniel Mundra Date: Thu, 22 Feb 2024 14:48:52 -0800 Subject: [PATCH 3/5] Ignoring markdown links config file. --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index a76e04a4..439556ff 100644 --- a/_config.yml +++ b/_config.yml @@ -137,3 +137,4 @@ exclude: - .gitlab-ci.yml - public - medium-posts-script + - markdown.links.config.json From 8fc1987ff8ac7bfeab798a6a370edd3803a71053 Mon Sep 17 00:00:00 2001 From: Daniel Mundra Date: Thu, 22 Feb 2024 15:29:32 -0800 Subject: [PATCH 4/5] Switched link checker to HTML proofer. --- .github/workflows/README.md | 6 +-- .github/workflows/link-check.yml | 22 ++++++--- Gemfile | 2 + Gemfile.lock | 23 +++++++++ _config.yml | 1 - markdown.links.config.json | 80 -------------------------------- package.json | 4 +- 7 files changed, 47 insertions(+), 91 deletions(-) delete mode 100644 markdown.links.config.json diff --git a/.github/workflows/README.md b/.github/workflows/README.md index eeee0304..1da92512 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -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 @@ -54,7 +54,6 @@ 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/ @@ -62,4 +61,5 @@ This action checks all markdown links for issues. * 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 diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index 13e38304..b33a36f1 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -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 diff --git a/Gemfile b/Gemfile index e90919d8..e0d1050a 100644 --- a/Gemfile +++ b/Gemfile @@ -7,3 +7,5 @@ group :jekyll_plugins do gem 'jekyll-redirect-from' gem 'jekyll-feed' end + +gem 'html-proofer' diff --git a/Gemfile.lock b/Gemfile.lock index a92cf70c..5d1455f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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 diff --git a/_config.yml b/_config.yml index 439556ff..a76e04a4 100644 --- a/_config.yml +++ b/_config.yml @@ -137,4 +137,3 @@ exclude: - .gitlab-ci.yml - public - medium-posts-script - - markdown.links.config.json diff --git a/markdown.links.config.json b/markdown.links.config.json deleted file mode 100644 index 75fae4d5..00000000 --- a/markdown.links.config.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "ignorePatterns": [ - { - "NOTE: Authenticated sites below": "", - "pattern": "^https://github.com/settings/two_factor_authentication/configure$" - }, - { - "pattern": "^https://docs.google.com/.*" - }, - { - "pattern": "^http://ci.civicactions.net/$" - }, - { - "pattern": "^https://app.skills-base.com/.*" - }, - { - "pattern": "^https://app.statuscake.com/.*" - }, - { - "pattern": "^https://docs.google.com/.*" - }, - { - "pattern": "^https://www.linkedin.com/company/civicactions/$" - }, - { - "NOTE: Sites with captcha protection below": "", - "pattern": "^https://.*drupal.org/.*" - }, - { - "pattern": "^https://.*.lastpass.com/.*" - }, - { - "pattern": "^https://twitter.com/.*" - }, - { - "pattern": "^https://support.yubico.com/.*" - }, - { - "pattern": "^https://.*.zendesk.com/.*" - }, - { - "pattern": "^https://support.zoom.us/.*" - }, - { - "pattern": "^https://identity.trinet.com/.*" - }, - { - "pattern": "^https://.*.ecosia.org/.*" - }, - { - "NOTE: Unreliable sites below": "", - "pattern": "^https://nedjo.ca/.*" - }, - { - "pattern": "^http://linux.die.net/.*" - }, - { - "pattern": "^https://linux.die.net/.*" - }, - { - "pattern": "^https://duckduckgo.com/.*" - }, - { - "pattern": "^https://askubuntu.com/.*" - } - ], - "httpHeaders": [ - { - "urls": [ - "https://github.com/", - "https://guides.github.com/", - "https://help.github.com/", - "https://docs.github.com/" - ], - "headers": { - "Accept-Encoding": "zstd, br, gzip, deflate" - } - } - ] -} diff --git a/package.json b/package.json index bc5a1a03..e52ffc48 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "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", @@ -11,7 +12,8 @@ "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" From 234609ed14bd37f787486a6402219046a07b8dda Mon Sep 17 00:00:00 2001 From: Daniel Mundra Date: Thu, 22 Feb 2024 15:38:56 -0800 Subject: [PATCH 5/5] Ignoring 302 codes and fixing a few links. --- _guide/champions-program.md | 1 - _guide/tools.md | 2 +- package.json | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/_guide/champions-program.md b/_guide/champions-program.md index 9824f448..4bd86676 100644 --- a/_guide/champions-program.md +++ b/_guide/champions-program.md @@ -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 diff --git a/_guide/tools.md b/_guide/tools.md index 50a9fdc4..072a8f31 100644 --- a/_guide/tools.md +++ b/_guide/tools.md @@ -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) diff --git a/package.json b/package.json index e52ffc48..0cf47d17 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "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", - "link-checker": "bundle exec htmlproofer --ignore-status-codes \"999,403,0\" --ignore-urls \"/fonts.gstatic.com/\" --enforce_https \"false\" ./_site" + "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"