Action logs (#22)

* print in logs information

* skip with parameters

* use Neutral in skip

* .

* error message

* logs

* .

* messages

* validate inputs

* finish with details

* empty line
This commit is contained in:
Miguel Savignano 2021-10-31 12:16:08 +01:00 committed by GitHub
parent 0eccc01b91
commit 8b86512c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -27,8 +27,9 @@ service = MergeBrachService.new(inputs, @event)
if service.valid?
@client = Octokit::Client.new(access_token: @github_token)
@client.merge(@repository, inputs[:target_branch], @head_to_merge, {commit_message: ENV['INPUT_MESSAGE']})
puts "Finish merge branch to #{inputs[:target_branch]}"
puts "Running perform merge target_branch: #{inputs[:target_branch]} @head_to_merge: #{@head_to_merge}}"
@client.merge(@repository, inputs[:target_branch], @head_to_merge, ENV['INPUT_MESSAGE'] ? {commit_message: ENV['INPUT_MESSAGE']} : {})
puts "Completed: Finish merge branch #{@head_to_merge} to #{inputs[:target_branch]}"
else
puts 'Skip'
puts "Neutral: skip merge target_branch: #{inputs[:target_branch]} @head_to_merge: #{@head_to_merge}"
end

View File

@ -5,10 +5,10 @@ class MergeBrachService
TYPE_NOW = "now".freeze
def self.validate_inputs!(target_branch:, type:, label_name:)
raise "Invalid type" unless [TYPE_LABELED, TYPE_NOW].include?(type)
raise "Empty target branch" unless target_branch
raise "Error: Invalid type" unless [TYPE_LABELED, TYPE_NOW].include?(type)
raise "Error: Empty target branch"unless target_branch
if type == TYPE_LABELED
raise "Empty target label name" unless label_name
raise " Error: Empty target label name" unless label_name
end
end