Skip to content

Commit 3c908ed

Browse files
authored
Merge pull request #970 from github/token
try using GITHUB_TOKEN in CI and obtaining fewer 429s etc?
2 parents a07bb2f + 1260fc2 commit 3c908ed

10 files changed

Lines changed: 25 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ jobs:
1414
with:
1515
bundler-cache: true
1616
- name: Build and test site
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1719
run: bundle exec rake test

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ group :jekyll_plugins do
1111
end
1212

1313
group :development, :test do
14-
gem 'html-proofer'
14+
gem 'html-proofer', '~> 4.0'
1515
gem 'parallel'
1616
gem 'rake'
1717
gem 'rubocop'

Rakefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ require 'html-proofer'
44

55
task :test do
66
sh 'bundle exec jekyll build'
7-
HTMLProofer.check_directory('./_site/',
8-
check_html: true,
9-
hydra: { max_concurrency: 10 },
10-
url_ignore: [%r{https://developer.github.com}, %r{https://docs.github.com}, %r{https://help.github.com}],
11-
http_status_ignore: [429]).run
7+
proofer = HTMLProofer.check_directory(
8+
'./_site/',
9+
check_html: true,
10+
check_external_hash: false,
11+
hydra: { max_concurrency: 10 },
12+
url_ignore: [%r{https://developer.github.com}, %r{https://docs.github.com}, %r{https://help.github.com}],
13+
ignore_status_codes: [429]
14+
)
15+
token = ENV.fetch('GITHUB_TOKEN', nil)
16+
unless token.nil?
17+
proofer.before_request do |request|
18+
request.options[:headers]['Authorization'] = "Bearer #{token}" if request.base_url == 'https://github.com'
19+
end
20+
end
21+
proofer.run
1222
end

_data/civic_hackers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ Code For America:
197197
- code-for-tb
198198
- code4hr
199199
- code4newark
200+
- code4nova
200201
- code4puertorico
201202
- code4sac
202203
- codeforabq
@@ -284,7 +285,6 @@ Code For America:
284285
- opentwincities
285286
- openwichita
286287
- openzagreb
287-
- sarl-hackerspace
288288
- scodemeetup
289289
- sewardparkstories
290290
- sfbrigade

_data/governments.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ International:
323323
- ogpl
324324

325325
Ireland:
326-
- FSAIreland
327326
- HSEIreland
328327

329328
Isle of Man:
@@ -401,7 +400,6 @@ New Zealand:
401400
- nz-mbie
402401
- nz-social-investment-agency
403402
- opcnz
404-
- R9BetterAPIs
405403
- te-papa
406404

407405
Norway:
@@ -413,7 +411,6 @@ Norway:
413411
- DirektoratetForByggkvalitet
414412
- dsb-norge
415413
- dss-web
416-
- fylkesmannen
417414
- kartverket
418415
- knreise
419416
- KRD-KOMM-VL
@@ -461,7 +458,6 @@ Republic of Korea:
461458
- molit-korea
462459

463460
Romania:
464-
- gov-ithub
465461
- govro
466462
- MinistryOfLabor
467463

@@ -719,7 +715,6 @@ U.S. City:
719715
- cityofboulder
720716
- cityofburlington
721717
- cityofchattanooga
722-
- cityoffortworth
723718
- CityOfLosAngeles
724719
- cityofnewyork
725720
- CityOfPhiladelphia
@@ -924,13 +919,11 @@ U.S. Federal:
924919
- usgpo
925920
- usgs
926921
- USGS-Astrogeology
927-
- USGS-CIDA
928922
- usgs-cmg
929923
- usgs-eros
930924
- USGS-OWI
931925
- USGS-R
932926
- USGS-WiM
933-
- usindianaffairs
934927
- usnationalarchives
935928
- usopm
936929
- USPS
@@ -1023,7 +1016,6 @@ U.S. States:
10231016
- twdb
10241017
- TxDOT
10251018
- UtahForestryFireStateLands
1026-
- VDEQ
10271019
- VDGIF
10281020
- Virginia-Department-of-Health
10291021
- Virginia-House-of-Delegates
@@ -1052,9 +1044,6 @@ United Nations:
10521044
- worldbank
10531045
- WorldBank-Transport
10541046

1055-
Uruguay:
1056-
- gubuy
1057-
10581047
Venezuela:
10591048
- CanaimaGNULinux
10601049
- suscerte

_layouts/form-page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h1 class="alt-h2 pt-4 pb-3 pt-sm-5">{{ page.title }}</h1>
2424

2525
<!---for form --->
2626
<script src="{{ "/assets/js/utm_form-1.0.3.min.js" | relative_url }}"></script>
27-
<script src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js"></script>
27+
<script src="https://js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js"></script>
2828
<script src="{{ "/assets/js/validate.js" | relative_url }}"></script>
2929
<script src="{{ "/assets/js/geoip.js" | relative_url }}"></script>
3030

script/alphabetize

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require 'yaml'
1010
files = Dir["#{File.expand_path('../_data/', File.dirname(__FILE__))}/*.yml"]
1111

1212
files.each do |file|
13-
contents = File.open(file).read
13+
contents = File.read(file)
1414
comment = contents.lines.first
1515

1616
data = YAML.safe_load(contents)
@@ -25,5 +25,5 @@ files.each do |file|
2525
# Add extra line break between groups, indent arrays, and strip header
2626
formatted_output = comment + output.to_yaml.gsub(/^(.+?):$/, "\n\\1:").gsub(/^- /, ' - ').gsub(/\A---\n/m, '')
2727

28-
File.open(file, 'w') { |f| f.write(formatted_output) }
28+
File.write(file, formatted_output)
2929
end

script/ensure-orgs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ files.each do |file|
4848
data[group] = data[group] - not_orgs
4949
end
5050

51-
comment = File.open(file).read.lines.first
51+
comment = File.read(file).lines.first
5252
output = comment
5353
output << "\n"
5454
output << data.to_yaml.sub(/\A---\n/, '').gsub(/^-/, ' -').gsub(/\n([^ ])/, "\n\n\\1")

script/fetch-cfa

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module CFA
3131
org_file['Code for All'] = code_for_all_orgs
3232
org_file['Civic Hackers'] = civic_hackers - brigades - code_for_all_orgs + to_be_removed
3333

34-
comment = File.open(org_file_path).read.lines.first
34+
comment = File.read(org_file_path).lines.first
3535
output = comment
3636
output << "\n"
3737
output << org_file.to_yaml.sub(/\A---\n/, '').gsub(/^-/, ' -').gsub(/\n([^ ])/, "\n\n\\1")

script/fetch-us

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ org_file['U.S. Federal'] = org_file['U.S. Federal'].uniq.sort_by(&:upcase)
4747
puts "\n\nMissing from registry:"
4848
puts((us_gov - orgs.map(&:downcase)).to_yaml)
4949

50-
comment = File.open(org_file_path).read.lines.first
50+
comment = File.read(org_file_path).lines.first
5151
output = comment
5252
output << "\n"
5353
output << org_file.to_yaml.sub(/\A---\n/, '').gsub(/^-/, ' -').gsub(/\n([^ ])/, "\n\n\\1")

0 commit comments

Comments
 (0)