miq_bot icon indicating copy to clipboard operation
miq_bot copied to clipboard

Issue manager should be case insensitive when someone is asking to apply a label

Open jrafanie opened this issue 9 years ago • 2 comments

If you add_label WIP when the label is "wip", it fails.

jrafanie avatar May 28 '15 14:05 jrafanie

@jrafanie the command add_label WIP works because of downcase in the line here.

From: /root/miq_bot/lib/github_service/commands/add_label.rb @ line 10 GithubService::Commands::AddLabel#_execute:

     9: def _execute(issuer:, value:)
 => 10:   binding.pry
    11:   valid, invalid = extract_label_names(value)
    12: 
    13:   if invalid.any?
    14:     message = "@#{issuer} Cannot apply the following label#{"s" if invalid.length > 1} because they are not recognized: "
    15:     message << invalid.join(", ")
    16:     issue.add_comment(message)
    17:   end
    18: 
    19:   if valid.any?
    20:     valid.reject! { |l| issue.applied_label?(l) }
    21:     issue.add_labels(valid)
    22:   end
    23: end

[1] pry(#<GithubService::Commands::AddLabel>)> value
=> "WIP"
[2] pry(#<GithubService::Commands::AddLabel>)> valid, invalid = extract_label_names(value)
I, [2018-04-21T21:15:52.738854 #12894]  INFO -- : Executed GET https://api.github.com/repos/xtest123/testrepo/labels?per_page=100...api calls remaining 4977
=> [["wip"], []]
[3] pry(#<GithubService::Commands::AddLabel>)> invalid.any?
=> false
[4] pry(#<GithubService::Commands::AddLabel>)> valid.any?
=> true
[5] pry(#<GithubService::Commands::AddLabel>)> valid.reject! { |l| issue.applied_label?(l) }
=> nil
[6] pry(#<GithubService::Commands::AddLabel>)> valid
=> ["wip"]
[7] pry(#<GithubService::Commands::AddLabel>)> issue.add_labels(valid)
I, [2018-04-21T21:16:49.896913 #12894]  INFO -- : Executed PATCH https://api.github.com/repos/xtest123/testrepo/issues/4...api calls remaining 4976
I, [2018-04-21T21:16:50.662081 #12894]  INFO -- : Executed POST https://api.github.com/repos/xtest123/testrepo/issues/4/labels...api calls remaining 4975
=> [{:id=>848974166,
 :url=>"https://api.github.com/repos/xtest123/testrepo/labels/test",
 :name=>"test",
 :color=>"76e87f",
 :default=>false}
,
 {:id=>899121700,
 :url=>"https://api.github.com/repos/xtest123/testrepo/labels/unmergeable",
 :name=>"unmergeable",
 :color=>"ededed",
 :default=>false}
,
 {:id=>873246145,
 :url=>"https://api.github.com/repos/xtest123/testrepo/labels/wip",
 :name=>"wip",
 :color=>"fef2c0",
 :default=>false}
]

europ avatar Apr 23 '18 09:04 europ

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.

miq-bot avatar Jun 11 '20 22:06 miq-bot