diff --git a/Gemfile.lock b/Gemfile.lock index ecade4e01..0d5583ad6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ PATH specs: github_changelog_generator (1.15.2) activesupport + async (>= 1.25.0) async-http-faraday faraday-http-cache multi_json diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index fb36b6aa4..4d9110b9c 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -98,7 +98,8 @@ def client def get_all_tags print "Fetching tags...\r" if @options[:verbose] - check_github_response { github_fetch_tags } + all_tags = check_github_response { github_fetch_tags } + all_tags.select { |tag| commits.any? { |commit| commit[:sha] == tag["commit"]["sha"] } } end # Returns the number of pages for a API call diff --git a/spec/unit/octo_fetcher_spec.rb b/spec/unit/octo_fetcher_spec.rb index f128872fc..d05079977 100644 --- a/spec/unit/octo_fetcher_spec.rb +++ b/spec/unit/octo_fetcher_spec.rb @@ -76,11 +76,17 @@ end describe "#get_all_tags" do + let(:in_branch_tags) { [{ "commit" => { "sha" => "in-branch" } }] } + let(:mock_tags) do + in_branch_tags + [{ "commit" => { "sha" => "off-branch" } }] + end + let(:mock_commits) { [{ sha: "in-branch" }] } + context "when github_fetch_tags returns tags" do - it "returns tags" do - mock_tags = ["tag"] + it "returns tags that are on the current branch" do allow(fetcher).to receive(:github_fetch_tags).and_return(mock_tags) - expect(fetcher.get_all_tags).to eq(mock_tags) + allow(fetcher).to receive(:commits).and_return(mock_commits) + expect(fetcher.get_all_tags).to eq(in_branch_tags) end end end
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: