Skip to content

Commit

Permalink
Merge pull request #152 from OpenGeoMetadata/archived-repos
Browse files Browse the repository at this point in the history
Skip harvesting of repositories that have been archived
  • Loading branch information
hudajkhan authored Apr 6, 2023
2 parents 6b2fd2b + 63a7609 commit e46b95e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/geo_combine/harvester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def clone_all
def repositories
@repositories ||= JSON.parse(Net::HTTP.get(self.class.ogm_api_uri))
.filter { |repo| repo['size'].positive? }
.reject { |repo| repo['archived'] }
.map { |repo| repo['name'] }
.reject { |name| self.class.denylist.include? name }
end
Expand Down
10 changes: 8 additions & 2 deletions spec/lib/geo_combine/harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
[
{ name: repo_name, size: 100 },
{ name: 'another-institution', size: 100 },
{ name: 'aardvark', size: 300 }, # on denylist
{ name: 'empty', size: 0 } # no data
{ name: 'outdated-institution', size: 100, archived: true }, # archived
{ name: 'aardvark', size: 300 }, # on denylist
{ name: 'empty', size: 0 } # no data
].to_json
end

Expand Down Expand Up @@ -71,6 +72,11 @@
harvester.pull_all
expect(Git).not_to have_received(:open).with('https://github.com/OpenGeoMetadata/aardvark.git')
end

it 'skips archived repositories' do
harvester.pull_all
expect(Git).not_to have_received(:open).with('https://github.com/OpenGeoMetadata/outdated-institution.git')
end
end

describe '#clone' do
Expand Down

0 comments on commit e46b95e

Please sign in to comment.