Skip to content

Commit

Permalink
Merge pull request #229 from simplybusiness/tweak-message
Browse files Browse the repository at this point in the history
Update version bump message format and fix heading levels
  • Loading branch information
addersuk authored Oct 21, 2024
2 parents 24d883f + 058953d commit 110736c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-10-18 15:57:43 UTC using RuboCop version 1.66.1.
# on 2024-10-21 10:03:50 UTC using RuboCop version 1.66.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -27,4 +27,4 @@ RSpec/VerifiedDoubles:
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 173
Max: 174
2 changes: 1 addition & 1 deletion lib/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def initiate_version_update(level)
else
add_reaction('confused')
puts "::error title=Unknown semver level::The semver level #{level} is not valid"
"## :boom: Error:boom: \n\nThe semver level #{level} is not valid so failing the action. Expecting a semver level of #{VALID_SEMVER_LEVELS.join(', ')}"
"### :boom: Error:boom: \n\nThe semver level #{level} is not valid so failing the action. Expecting a semver level of #{VALID_SEMVER_LEVELS.join(', ')}"
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class Command

def initialize(config)
@config = config
@message = "### Dobby bumping the version\n"
@message = "## Dobby bumping the version\n"
comment = config.payload['comment']['body'].strip.downcase
unless comment.start_with?(COMMAND_PREFIX)
error_msg = "Comment must start with #{COMMAND_PREFIX}"
puts "::error title=Argument Error::#{error_msg}"
@message += "## :boom: Error:boom:\n\n The comment must start with #{COMMAND_PREFIX} so failing the action."
@message += "### :boom: Error:boom:\n\n The comment must start with #{COMMAND_PREFIX} so failing the action."
raise ArgumentError, error_msg
end

Expand All @@ -30,7 +30,7 @@ def call
when 'version'
@message += action.initiate_version_update(options).to_s
else
@message += "## :boom: Error:boom:\n\nThe command #{command} is not valid so failing the action. Expecting a command of 'version'."
@message += "### :boom: Error:boom:\n\nThe command #{command} is not valid so failing the action. Expecting a command of 'version'."
puts "::error title=Unknown command::The command #{command} is not valid"
action.add_reaction('confused')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def bump_version(version, level)

def generate_message(files_messages)
message = "### Bump version from #{@version} to #{@updated_version}\n"
message += "Dobby has attempted to update the following files\n"
message += "| File Name | Message |\n"
message += "|-----------|---------|\n"
files_messages.each do |file_name, msg|
message += "| #{file_name} | #{msg} |\n"
end
message += "|-----------|---------|\n"
message
end
end
2 changes: 1 addition & 1 deletion spec/lib/action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
it 'reacts with confused emoji for invalid semver' do
expect(action).to receive(:add_reaction).with('confused')
message = action.initiate_version_update('invalid_semver')
expect(message).to eq("## :boom: Error:boom: \n\nThe semver level invalid_semver is not valid so failing the action. Expecting a semver level of minor, major, patch")
expect(message).to eq("### :boom: Error:boom: \n\nThe semver level invalid_semver is not valid so failing the action. Expecting a semver level of minor, major, patch")
end

it 'bumps major version' do
Expand Down
4 changes: 2 additions & 2 deletions temp.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Dobby bumping the version
## :boom: Error:boom:
## Dobby bumping the version
### :boom: Error:boom:

The command barney is not valid so failing the action. Expecting a command of 'version'.

0 comments on commit 110736c

Please sign in to comment.