aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-02-27 18:03:11 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-06-05 09:12:46 +0200
commit0b44bb47131f6c02836715a5273636b107b9695d (patch)
tree6bd64e691a658a35b0dd741d1eb896d521c39675 /mod
parentdc3c800a643713f85eb19b217cd1663b788d4be7 (diff)
Use "event" most of the time and "webhook event" for more context
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci-github.cxx20
-rw-r--r--mod/mod-ci-github.hxx4
2 files changed, 17 insertions, 7 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 6782e71..cb781e3 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -70,9 +70,16 @@ namespace brep
// Process headers.
//
- string event;
// @@ TMP Shouldn't we also error<< in some of these header problem cases?
//
+ // @@ TMP From GitHub docs: "You can create webhooks that subscribe to the
+ // events listed on this page."
+ //
+ // So it seems appropriate to generally use the term "event" (which
+ // we already do for the most part), and "webhook event" only when
+ // more context would be useful?
+ //
+ string event; // Webhook event.
{
bool content_type (false);
@@ -113,8 +120,9 @@ namespace brep
throw invalid_request (400, "missing x-github-event header");
}
- // There is an event (specified in the x-github-event header) and each event
- // contains a bunch of actions (specified in the JSON request body).
+ // There is a webhook event (specified in the x-github-event header) and
+ // each event contains a bunch of actions (specified in the JSON request
+ // body).
//
// Note: "GitHub continues to add new event types and new actions to
// existing event types." As a result we ignore known actions that we are
@@ -127,7 +135,7 @@ namespace brep
check_suite_event cs;
try
{
- json::parser p (rq.content (64 * 1024), "check_suite webhook");
+ json::parser p (rq.content (64 * 1024), "check_suite event");
cs = check_suite_event (p);
}
@@ -169,7 +177,7 @@ namespace brep
// Ignore unknown actions by sending a 200 response with empty body
// but also log as an error since we want to notice new actions.
//
- error << "unknown action '" << cs.action << "' in check_suite webhook";
+ error << "unknown action '" << cs.action << "' in check_suite event";
return true;
}
@@ -193,7 +201,7 @@ namespace brep
bool ci_github::
handle_check_suite_request (check_suite_event cs) const
{
- cout << "<check_suite webhook>" << endl << cs << endl;
+ cout << "<check_suite event>" << endl << cs << endl;
installation_access_token iat (
obtain_installation_access_token (cs.installation.id, generate_jwt ()));
diff --git a/mod/mod-ci-github.hxx b/mod/mod-ci-github.hxx
index f9fb7e6..ca6c7bf 100644
--- a/mod/mod-ci-github.hxx
+++ b/mod/mod-ci-github.hxx
@@ -31,7 +31,7 @@ namespace brep
{
namespace json = butl::json;
- // The "check_suite" object within a check_suite webhook request.
+ // The "check_suite" object within a check_suite webhook event request.
//
struct check_suite
{
@@ -69,6 +69,8 @@ namespace brep
installation () = default;
};
+ // The check_suite webhook event request.
+ //
struct check_suite_event
{
string action;