diff --git a/modules/webhook.cc b/modules/webhook.cc index 9d008bfb0..18ebc24af 100644 --- a/modules/webhook.cc +++ b/modules/webhook.cc @@ -477,9 +477,14 @@ static std::ostream & github_handle__issues(std::ostream &out, const json::object &content) { + const json::string &action + { + content["action"] + }; + out << " " << "" - << unquote(content["action"]) + << action << "" ; @@ -488,7 +493,7 @@ github_handle__issues(std::ostream &out, content["issue"] }; - switch(hash(unquote(content["action"]))) + switch(hash(action)) { case "assigned"_: case "unassigned"_: @@ -520,7 +525,25 @@ github_handle__issues(std::ostream &out, << "" ; - if(unquote(content["action"]) == "opened") + if(action != "labeled") + for(const json::object &label : json::array(issue["labels"])) + { + out << " "; + out << ""; + + out << ""; + out << " "; + out << unquote(label["name"]); + out << " "; + out << ""; + + out << ""; + } + + if(action == "opened") { out << " " << "
" @@ -544,7 +567,7 @@ github_handle__issues(std::ostream &out, << "" ; } - else if(unquote(content["action"]) == "labeled") + else if(action == "labeled") { const json::array labels { @@ -566,9 +589,9 @@ github_handle__issues(std::ostream &out, << "\">"; out << ""; - out << " "; + out << " "; out << unquote(label["name"]); - out << " "; + out << " "; out << ""; out << "";