From 8ac3fdf7316cc0a2ca52de4f10c763b9ae211671 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Fri, 30 Sep 2022 14:01:06 +0100 Subject: [PATCH] BAU: Test for GITHUB_TOKEN --- .github/workflows/rubyandnode.yaml | 3 + Gemfile | 2 +- Gemfile.lock | 98 +++++++++++++++++++----------- config.rb | 11 +++- 4 files changed, 75 insertions(+), 39 deletions(-) diff --git a/.github/workflows/rubyandnode.yaml b/.github/workflows/rubyandnode.yaml index 9345d16e..e4413246 100644 --- a/.github/workflows/rubyandnode.yaml +++ b/.github/workflows/rubyandnode.yaml @@ -13,6 +13,9 @@ jobs: with: ruby-version: '2.7' bundler-cache: true + bundler: '1.17.2' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set up Node uses: actions/setup-node@v1 with: diff --git a/Gemfile b/Gemfile index d36511e4..c9da2f51 100644 --- a/Gemfile +++ b/Gemfile @@ -12,4 +12,4 @@ gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby] gem 'govuk_tech_docs' # Include linter to check for dead internal links -gem 'html-proofer' +gem 'html-proofer', '~> 3.19.4' diff --git a/Gemfile.lock b/Gemfile.lock index 89bc45aa..21c8201f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,14 @@ GEM remote: https://rubygems.org/ specs: - activesupport (5.2.7.1) + activesupport (6.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) autoprefixer-rails (10.4.7.0) execjs (~> 2) backports (3.23.0) @@ -17,7 +18,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - commonmarker (0.23.4) + commonmarker (0.23.6) compass (1.0.3) chunky_png (~> 1.2) compass-core (~> 1.0.2) @@ -32,11 +33,13 @@ GEM sass (>= 3.2, < 3.5) concurrent-ruby (1.1.10) contracts (0.13.0) - dotenv (2.7.6) + dotenv (2.8.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) erubis (2.7.0) + ethon (0.15.0) + ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.8.1) fast_blank (1.0.1) @@ -55,14 +58,23 @@ GEM nokogiri openapi3_parser (~> 0.9.0) redcarpet (~> 3.5.1) - haml (5.2.2) - temple (>= 0.8.0) + haml (6.0.3) + temple (>= 0.8.2) + thor tilt hamster (3.0.0) concurrent-ruby (~> 1.0) hashie (3.6.0) + html-proofer (3.19.4) + addressable (~> 2.3) + mercenary (~> 0.3) + nokogiri (~> 1.13) + parallel (~> 1.10) + rainbow (~> 3.0) + typhoeus (~> 1.3) + yell (~> 2.0) http_parser.rb (0.8.0) - i18n (0.9.5) + i18n (1.6.0) concurrent-ruby (~> 1.0) kramdown (2.4.0) rexml @@ -70,25 +82,26 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) memoist (0.16.2) - middleman (4.3.11) + mercenary (0.4.0) + middleman (4.4.2) coffee-script (~> 2.2) haml (>= 4.0.5) kramdown (>= 2.3.0) - middleman-cli (= 4.3.11) - middleman-core (= 4.3.11) + middleman-cli (= 4.4.2) + middleman-core (= 4.4.2) middleman-autoprefixer (2.10.0) autoprefixer-rails (>= 9.1.4) middleman-core (>= 3.3.3) - middleman-cli (4.3.11) + middleman-cli (4.4.2) thor (>= 0.17.0, < 2.0) middleman-compass (4.0.1) compass (>= 1.0.0, < 2.0.0) middleman-core (>= 4.0.0) - middleman-core (4.3.11) - activesupport (>= 4.2, < 6.0) - addressable (~> 2.3) + middleman-core (4.4.2) + activesupport (>= 6.1, < 7.0) + addressable (~> 2.4) backports (~> 3.6) - bundler + bundler (~> 2.0) contracts (~> 0.13.0) dotenv erubis @@ -97,16 +110,18 @@ GEM fastimage (~> 2.0) hamster (~> 3.0) hashie (~> 3.4) - i18n (~> 0.9.0) + i18n (~> 1.6.0) listen (~> 3.0.0) memoist (~> 0.14) - padrino-helpers (~> 0.13.0) + padrino-helpers (~> 0.15.0) parallel rack (>= 1.4.5, < 3) sassc (~> 2.0) servolux tilt (~> 2.0.9) + toml uglifier (~> 3.0) + webrick middleman-livereload (3.4.7) em-websocket (~> 0.5.1) middleman-core (>= 3.3) @@ -122,51 +137,62 @@ GEM middleman-core (>= 3.2) rouge (~> 3.2) mini_portile2 (2.8.0) - minitest (5.15.0) + minitest (5.16.3) multi_json (1.15.0) - nokogiri (1.13.6) + nokogiri (1.13.8) mini_portile2 (~> 2.8.0) racc (~> 1.4) openapi3_parser (0.9.2) commonmarker (~> 0.17) - padrino-helpers (0.13.3.4) - i18n (~> 0.6, >= 0.6.7) - padrino-support (= 0.13.3.4) + padrino-helpers (0.15.1) + i18n (>= 0.6.7, < 2) + padrino-support (= 0.15.1) tilt (>= 1.4.1, < 3) - padrino-support (0.13.3.4) - activesupport (>= 3.1) + padrino-support (0.15.1) parallel (1.22.1) - public_suffix (4.0.7) + parslet (2.0.0) + public_suffix (5.0.0) racc (1.6.0) rack (2.2.4) rack-livereload (0.3.17) rack - rb-fsevent (0.11.1) + rainbow (3.1.1) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.1) rexml (3.2.5) - rouge (3.28.0) + rouge (3.30.0) sass (3.4.25) sassc (2.4.0) ffi (~> 1.9) servolux (0.13.0) - sprockets (4.0.3) + sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) temple (0.8.2) thor (1.2.1) - thread_safe (0.3.6) - tilt (2.0.10) - tzinfo (1.2.10) - thread_safe (~> 0.1) + tilt (2.0.11) + toml (0.3.0) + parslet (>= 1.8.0, < 3.0.0) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) uglifier (3.2.0) execjs (>= 0.3.0, < 3) + webrick (1.7.0) + yell (2.2.2) + zeitwerk (2.6.0) PLATFORMS ruby DEPENDENCIES govuk_tech_docs + html-proofer (~> 3.19.4) tzinfo-data wdm (~> 0.1.0) + +BUNDLED WITH + 2.1.4 \ No newline at end of file diff --git a/config.rb b/config.rb index bac1e301..322cc29d 100644 --- a/config.rb +++ b/config.rb @@ -22,8 +22,15 @@ }) proofer.before_request do |request| - # We get rate-limited by GitHub so pause between checking GitHub links - sleep 2 if request.base_url == "https://github.com/" + # We get rate-limited by GitHub so pause between checking GitHub links or use a token + + if request.base_url != "https://github.com/" next + + if ENV.key?("GITHUB_TOKEN") + puts "Has Github token" + else + sleep 2 + end end proofer.run