Skip to content

Commit

Permalink
Merge pull request #4961 from alphagov/skip-docs
Browse files Browse the repository at this point in the history
Add skip_docs option, and skip siteimprove docs
  • Loading branch information
richardTowers authored Jan 23, 2025
2 parents e6d010d + b48d14f commit 6fc2b8e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/proxy_pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.resources
end

def self.repo_docs
docs = Repos.active_public.map do |repo|
docs = Repos.with_docs.map do |repo|
docs_for_repo = GitHubRepoFetcher.instance.docs(repo.repo_name) || []
docs_for_repo.map do |page|
{
Expand Down
4 changes: 4 additions & 0 deletions app/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def readme
github_readme
end

def skip_docs?
repo_data.fetch("skip_docs", false)
end

private

def kibana_url_for(app:, hours: 3, include: %w[level request status message])
Expand Down
4 changes: 4 additions & 0 deletions app/repos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def self.active_public
Repos.active.reject(&:private_repo?)
end

def self.with_docs
Repos.active_public.reject(&:skip_docs?)
end

def self.active_apps
Repos.all.reject(&:retired?).select(&:is_app?)
end
Expand Down
1 change: 1 addition & 0 deletions data/repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@
sentry_url: false
description: |
Used by content-data-admin Siteimprove integration.
skip_docs: true

- repo_name: slimmer
team: "#govuk-navigation-tech"
Expand Down
2 changes: 1 addition & 1 deletion spec/app/proxy_pages_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe ProxyPages do
before do
allow(Repos).to receive(:all)
.and_return([double("Repo", app_name: "", repo_name: "", page_title: "", description: "", private_repo?: false, retired?: false)])
.and_return([double("Repo", app_name: "", repo_name: "", page_title: "", description: "", skip_docs?: false, private_repo?: false, retired?: false)])
allow(DocumentTypes).to receive(:pages)
.and_return([double("Page", name: "")])
allow(Supertypes).to receive(:all)
Expand Down
10 changes: 10 additions & 0 deletions spec/app/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
end
end

describe "skip_docs?" do
it "returns false if 'skip_docs' is omitted" do
expect(Repo.new({}).skip_docs?).to be(false)
end

it "returns true if 'skip_docs' is true" do
expect(Repo.new({ "skip_docs" => true }).skip_docs?).to be(true)
end
end

describe "api_payload" do
it "returns a hash of keys describing the app" do
app_details = {
Expand Down

0 comments on commit 6fc2b8e

Please sign in to comment.