aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-02-27 18:03:11 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-15 09:05:27 +0200
commit412812154e8082c954c94ceb0900774e79c8fe55 (patch)
tree9e60af9ed44cbe8f36203ea40cf5ef660b045eef
parenta47fa04f5a4e6de23779aa964c96f0b9494ad56d (diff)
Use "event" most of the time and "webhook event" for more context
-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;