0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 00:02:34 +01:00

modules/web_hook: Add util to extract github repository name/url.

This commit is contained in:
Jason Volk 2022-06-24 16:46:39 -07:00
parent 4bf297e5e7
commit c56e16e20c

View file

@ -121,6 +121,9 @@ github_find_issue_number(const json::object &content);
static std::pair<json::string, json::string>
github_find_party(const json::object &content);
static std::pair<json::string, json::string>
github_find_repo(const json::object &content);
static bool
github_handle__milestone(std::ostream &,
const json::object &content);
@ -1658,6 +1661,31 @@ github_handle__ping(std::ostream &out,
return true;
}
std::pair<json::string, json::string>
github_find_repo(const json::object &content)
{
const json::object repository
{
content["repository"]
};
if(!empty(repository))
return
{
repository["full_name"], repository["html_url"]
};
const json::object organization
{
content["organization"]
};
return
{
organization["login"], organization["url"]
};
}
/// Researched from yestifico bot
std::pair<json::string, json::string>
github_find_party(const json::object &content)