From 60c7c912bd312644b49231b2f83a869be3884c8a Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 9 Sep 2024 13:31:49 -0700 Subject: [PATCH 1/7] Fix github.com matching --- lib/github-pages-health-check/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-pages-health-check/domain.rb b/lib/github-pages-health-check/domain.rb index f36bf7d..32c4344 100644 --- a/lib/github-pages-health-check/domain.rb +++ b/lib/github-pages-health-check/domain.rb @@ -283,7 +283,7 @@ def pages_dot_github_dot_com? # Is this domain owned by GitHub? def github_domain? - !!host.downcase.end_with?("github.com") + !!host.match(/(\A|\.)github\.com\.?\z/i) end # Is the host our Fastly CNAME? From bacc49a20fbb21469f762cb3575f73c24b16b937 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 9 Sep 2024 13:41:48 -0700 Subject: [PATCH 2/7] Add CODEOWNERS while there --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9529e05 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Automatically add our team to each pull request in this repo +* @github/pages-reviewers From 7d397c759e0e30a025a8399e04052928ae2b8c80 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 9 Sep 2024 13:49:23 -0700 Subject: [PATCH 3/7] Fix workflows --- .github/workflows/pages-gem.yml | 13 +++++++++---- .github/workflows/push-cibuild.yml | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pages-gem.yml b/.github/workflows/pages-gem.yml index 281512f..4f75e2b 100644 --- a/.github/workflows/pages-gem.yml +++ b/.github/workflows/pages-gem.yml @@ -4,6 +4,9 @@ on: release: types: [released] +permissions: + contents: read + jobs: release: runs-on: ubuntu-latest @@ -11,12 +14,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Setup Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0 with: ruby-version: '3.2' - name: Build gem run: | - gem build github-pages.gemspec - - name: Publish + gem build github-pages-health-check.gemspec + - name: Publish gem + env: + GEM_HOST_API_KEY: ${{ secrets.PAGES_GEM_PUBLISHING }} run: | - gem push github-pages.gem --key ${{ secrets.PAGES_GEM_PUBLISH }} + gem push github-pages-health-check-*.gem diff --git a/.github/workflows/push-cibuild.yml b/.github/workflows/push-cibuild.yml index 95eef5b..daf389c 100644 --- a/.github/workflows/push-cibuild.yml +++ b/.github/workflows/push-cibuild.yml @@ -1,5 +1,7 @@ on: push name: "GitHub Pages Health Check Tests" +permissions: + contents: read jobs: build: name: "GitHub Pages Health Check Tests" From ba28b5a688bb116b9df0321900a34afbbeee341d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 08:21:06 +0000 Subject: [PATCH 4/7] Update octokit requirement from >= 4, < 9 to >= 4, < 10 Updates the requirements on [octokit](https://github.com/octokit/octokit.rb) to permit the latest version. - [Release notes](https://github.com/octokit/octokit.rb/releases) - [Changelog](https://github.com/octokit/octokit.rb/blob/main/RELEASE.md) - [Commits](https://github.com/octokit/octokit.rb/compare/v4.0.0...v4.22.0) --- updated-dependencies: - dependency-name: octokit dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- github-pages-health-check.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-pages-health-check.gemspec b/github-pages-health-check.gemspec index 32dd25b..c6211c8 100644 --- a/github-pages-health-check.gemspec +++ b/github-pages-health-check.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.add_dependency("addressable", "~> 2.3") s.add_dependency("dnsruby", "~> 1.60") - s.add_dependency("octokit", ">= 4", "< 9") + s.add_dependency("octokit", ">= 4", "< 10") s.add_dependency("public_suffix", ">= 3.0", "< 6.0") s.add_dependency("typhoeus", "~> 1.3") end From c7a2b8311305df94f2c9592ca64b1c38e9204b48 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Tue, 10 Sep 2024 09:08:55 -0700 Subject: [PATCH 5/7] Simplify github_domain? check + add test --- lib/github-pages-health-check/domain.rb | 2 +- spec/github_pages_health_check/domain_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/github-pages-health-check/domain.rb b/lib/github-pages-health-check/domain.rb index 32c4344..83097f2 100644 --- a/lib/github-pages-health-check/domain.rb +++ b/lib/github-pages-health-check/domain.rb @@ -283,7 +283,7 @@ def pages_dot_github_dot_com? # Is this domain owned by GitHub? def github_domain? - !!host.match(/(\A|\.)github\.com\.?\z/i) + host.downcase.eql?("github.com") || host.downcase.end_with?(".github.com") end # Is the host our Fastly CNAME? diff --git a/spec/github_pages_health_check/domain_spec.rb b/spec/github_pages_health_check/domain_spec.rb index 2161a99..cc5a51d 100644 --- a/spec/github_pages_health_check/domain_spec.rb +++ b/spec/github_pages_health_check/domain_spec.rb @@ -535,6 +535,14 @@ end end + context "not github domains" do + let(:domain) { "somethinggithub.com" } + + it "knows if the domain is a github domain" do + expect(subject).to_not be_a_github_domain + end + end + context "fastly domain" do let(:domain) { "github.map.fastly.net" } From efba6bc8e3f9d962f35ee05e249878bfbe8804f5 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Tue, 10 Sep 2024 09:13:25 -0700 Subject: [PATCH 6/7] Update spec/github_pages_health_check/domain_spec.rb --- spec/github_pages_health_check/domain_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/github_pages_health_check/domain_spec.rb b/spec/github_pages_health_check/domain_spec.rb index cc5a51d..5ca16fa 100644 --- a/spec/github_pages_health_check/domain_spec.rb +++ b/spec/github_pages_health_check/domain_spec.rb @@ -538,7 +538,7 @@ context "not github domains" do let(:domain) { "somethinggithub.com" } - it "knows if the domain is a github domain" do + it "knows if the domain is not a github domain" do expect(subject).to_not be_a_github_domain end end From c7dc20c4931103781b11768b2783b1154ca84042 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:24:01 +0000 Subject: [PATCH 7/7] Update public_suffix requirement from >= 3.0, < 6.0 to >= 3.0, < 7.0 Updates the requirements on [public_suffix](https://github.com/weppos/publicsuffix-ruby) to permit the latest version. - [Changelog](https://github.com/weppos/publicsuffix-ruby/blob/main/CHANGELOG.md) - [Commits](https://github.com/weppos/publicsuffix-ruby/compare/v3.0.0...v3.1.1) --- updated-dependencies: - dependency-name: public_suffix dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- github-pages-health-check.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-pages-health-check.gemspec b/github-pages-health-check.gemspec index c6211c8..fcb2dcb 100644 --- a/github-pages-health-check.gemspec +++ b/github-pages-health-check.gemspec @@ -19,6 +19,6 @@ Gem::Specification.new do |s| s.add_dependency("addressable", "~> 2.3") s.add_dependency("dnsruby", "~> 1.60") s.add_dependency("octokit", ">= 4", "< 10") - s.add_dependency("public_suffix", ">= 3.0", "< 6.0") + s.add_dependency("public_suffix", ">= 3.0", "< 7.0") s.add_dependency("typhoeus", "~> 1.3") end