mirror of
https://github.com/matrix-construct/construct
synced 2024-05-30 08:43:48 +02:00
modules/webhook: Render markdown to html for dependabot alerts.
This commit is contained in:
parent
1f35421cec
commit
7904fa0563
|
@ -452,6 +452,10 @@ github_heading(std::ostream &out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string_view
|
||||||
|
github_markdown(unique_const_buffer &buf,
|
||||||
|
const string_view &text);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
github_handle__dependabot_alert(std::ostream &out,
|
github_handle__dependabot_alert(std::ostream &out,
|
||||||
const json::object &content)
|
const json::object &content)
|
||||||
|
@ -495,19 +499,17 @@ github_handle__dependabot_alert(std::ostream &out,
|
||||||
<< " 🚨<br>"
|
<< " 🚨<br>"
|
||||||
;
|
;
|
||||||
|
|
||||||
out
|
unique_const_buffer buf;
|
||||||
<< "<blockquote>"
|
const string_view markup
|
||||||
;
|
|
||||||
|
|
||||||
static const auto delim("\\n");
|
|
||||||
ircd::tokens(desc, delim, [&out]
|
|
||||||
(const string_view &line)
|
|
||||||
{
|
{
|
||||||
out << line << "<br>";
|
github_markdown(buf, desc)
|
||||||
});
|
};
|
||||||
|
|
||||||
out
|
out
|
||||||
<< "</blockquote>"
|
//<< "<blockquote>"
|
||||||
|
<< markup
|
||||||
|
//<< "</blockquote>"
|
||||||
|
<< "<br>"
|
||||||
;
|
;
|
||||||
|
|
||||||
if(path)
|
if(path)
|
||||||
|
@ -828,6 +830,24 @@ github_request(unique_const_buffer &out,
|
||||||
return github_request(content, out, method, repo, fmt, std::forward<args>(a)...);
|
return github_request(content, out, method, repo, fmt, std::forward<args>(a)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string_view
|
||||||
|
github_markdown(unique_const_buffer &buf,
|
||||||
|
const string_view &text)
|
||||||
|
{
|
||||||
|
const json::strung content
|
||||||
|
{
|
||||||
|
json::members
|
||||||
|
{
|
||||||
|
{ "text", text }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return _github_request
|
||||||
|
(
|
||||||
|
buf, "POST", "https://api.github.com/markdown", content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
github_run_for_each_jobs(const string_view &repo,
|
github_run_for_each_jobs(const string_view &repo,
|
||||||
const string_view &run_id,
|
const string_view &run_id,
|
||||||
|
|
Loading…
Reference in a new issue