diff --git a/.gitignore b/.gitignore index aa7e664a..37220a49 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ # Coverage directory used by simplycov coverage + +# Bundler +vendor/bundle +.bundle diff --git a/lib/utils/bump.rb b/lib/utils/bump.rb index e0dc13f7..9a85f849 100644 --- a/lib/utils/bump.rb +++ b/lib/utils/bump.rb @@ -86,10 +86,10 @@ def assign_pr_attributes!(pr_number) end def get_content_update(path) - head_branch_content = Content.new(config: @config, ref: @head_branch, path: path).content - updated_base_branch_content = update_file_contents(path, head_branch_content) + base_branch_content = Content.new(config: @config, ref: @base_branch, path: path).content + updated_base_branch_content = update_file_contents(path, base_branch_content) - if head_branch_content == updated_base_branch_content + if base_branch_content == updated_base_branch_content puts "::notice title=Nothing to update::The desired version bump is already present for: #{path}" return nil end diff --git a/spec/lib/utils/bump_spec.rb b/spec/lib/utils/bump_spec.rb index f7a9e782..d114e494 100644 --- a/spec/lib/utils/bump_spec.rb +++ b/spec/lib/utils/bump_spec.rb @@ -13,7 +13,6 @@ let(:other_version_file_paths) { ['path/to/other/version/file'] } let(:other_version_patterns) { [] } let(:base_content) { instance_double(Content) } - let(:head_content) { instance_double(Content) } let(:commit) { instance_double(Commit) } before do @@ -25,10 +24,6 @@ config: config, ref: 'base_branch', path: anything ).and_return(base_content) - allow(Content).to receive(:new).with( - config: config, ref: 'head_branch', - path: anything - ).and_return(head_content) allow(client).to receive(:pull_request).with( 'owner/repo', @@ -61,7 +56,6 @@ describe '#bump_everything' do it 'bumps the version and commits the changes' do - allow(head_content).to receive(:content).and_return('version: 1.0.0') allow(base_content).to receive(:content).and_return('version: 1.0.0') bump = Bump.new(config, 'patch') @@ -75,25 +69,8 @@ bump.bump_everything end - it 'skips updating if the desired version bump is already present' do - allow(head_content).to receive(:content).and_return('version: 1.0.1') - allow(base_content).to receive(:content).and_return('version: 1.0.0') - - bump = Bump.new(config, 'patch') - expect(commit).not_to receive(:multiple_files) - expect do - bump.bump_everything - end.to output( - "::notice title=Nothing to update::The desired version bump is already present for: " \ - "#{other_version_file_paths[0]}\n" \ - "::notice title=Nothing to update::The desired version bump is already present for: " \ - "#{version_file_path}\n" - ).to_stdout - end - it 'retains modified version file content' do - allow(head_content).to receive(:content).and_return('version: 1.0.0 extra stuff here') - allow(base_content).to receive(:content).and_return('version: 1.0.0') + allow(base_content).to receive(:content).and_return('version: 1.0.0 extra stuff here') bump = Bump.new(config, 'patch') expect(commit).to receive(:multiple_files).with( @@ -110,7 +87,6 @@ end it 'handles python underscored version format' do - allow(head_content).to receive(:content).and_return('__version__ = "1.0.0"') allow(base_content).to receive(:content).and_return('__version__ = "1.0.0"') bump = Bump.new(config, 'patch')