diff --git a/lib/fbe/octo.rb b/lib/fbe/octo.rb index 8660628..0c3fd9f 100644 --- a/lib/fbe/octo.rb +++ b/lib/fbe/octo.rb @@ -235,7 +235,7 @@ def repository(name) has_pages: false, has_discussions: false, forks_count: 0, - archived: false, + archived: name == 'zerocracy/datum', disabled: false, open_issues_count: 6, license: { key: 'mit', name: 'MIT License' }, diff --git a/lib/fbe/unmask_repos.rb b/lib/fbe/unmask_repos.rb index 323e3c3..7d9569e 100644 --- a/lib/fbe/unmask_repos.rb +++ b/lib/fbe/unmask_repos.rb @@ -37,6 +37,7 @@ def self.mask_to_regex(mask) def self.unmask_repos(options: $options, global: $global, loog: $loog) repos = [] + octo = Fbe.octo(loog:, global:, options:) masks = (options.repositories || '').split(',') masks.reject { |m| m.start_with?('-') }.each do |mask| unless mask.include?('*') @@ -44,7 +45,7 @@ def self.unmask_repos(options: $options, global: $global, loog: $loog) next end re = Fbe.mask_to_regex(mask) - Fbe.octo(loog:, global:, options:).repositories(mask.split('/')[0]).each do |r| + octo.repositories(mask.split('/')[0]).each do |r| repos << r[:full_name] if re.match?(r[:full_name]) end end @@ -52,6 +53,7 @@ def self.unmask_repos(options: $options, global: $global, loog: $loog) re = Fbe.mask_to_regex(mask[1..]) repos.reject! { |r| re.match?(r) } end + repos.reject! { |repo| octo.repository(repo)[:archived] } raise "No repos found matching: #{options.repositories}" if repos.empty? loog.debug("Scanning #{repos.size} repositories: #{repos.join(', ')}...") repos diff --git a/test/fbe/test_unmask_repos.rb b/test/fbe/test_unmask_repos.rb index 5446248..8ae70a4 100644 --- a/test/fbe/test_unmask_repos.rb +++ b/test/fbe/test_unmask_repos.rb @@ -37,22 +37,25 @@ def test_simple_use opts = Judges::Options.new( { 'testing' => true, - 'repositories' => 'yegor256/tacit,zerocracy/*,-zerocracy/judges-action' + 'repositories' => 'yegor256/tacit,zerocracy/*,-zerocracy/judges-action,zerocracy/datum' } ) - assert(Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL).size.positive?) + list = Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL) + assert(list.size.positive?) + refute_includes(list, 'zerocracy/datum') end def test_live_usage skip('Run it only manually, since it touches GitHub API') - Judges::Options.new( + opts = Judges::Options.new( { - 'repositories' => 'zerocracy/*,-zerocracy/judges-action' + 'repositories' => 'zerocracy/*,-zerocracy/judges-action,zerocracy/datum' } ) list = Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL) assert(list.size.positive?) assert(list.include?('zerocracy/pages-action')) assert(!list.include?('zerocracy/judges-action')) + refute_includes(list, 'zerocracy/datum') end end