aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci-github-gh.cxx2
-rw-r--r--mod/mod-ci-github-gh.hxx60
-rw-r--r--mod/mod-ci-github.cxx6
3 files changed, 31 insertions, 37 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx
index 9a3f295..9eebf34 100644
--- a/mod/mod-ci-github-gh.cxx
+++ b/mod/mod-ci-github-gh.cxx
@@ -209,7 +209,7 @@ namespace brep
else p.next_expect_value_skip ();
}
- if (!ai) missing_member (p, "gh_check_suite.app", "id");
+ if (!ai) missing_member (p, "gh_check_suite_ex.app", "id");
}
else p.next_expect_value_skip ();
}
diff --git a/mod/mod-ci-github-gh.hxx b/mod/mod-ci-github-gh.hxx
index 0028129..b34dfd1 100644
--- a/mod/mod-ci-github-gh.hxx
+++ b/mod/mod-ci-github-gh.hxx
@@ -45,10 +45,6 @@ namespace brep
// The check_suite member of a check_run webhook event (gh_check_run_event).
//
- // @@ TMP In the check_run context only the head_sha is used so perhaps it
- // would be better to move the other members directly into the _ex
- // version?
- //
struct gh_check_suite
{
string node_id;
@@ -134,8 +130,6 @@ namespace brep
// simplicity we emulate check_suite and check_run by storing the app-id
// webhook query parameter here.
//
- // @@ TODO Explain multiple apps in INSTALL-GITHUB-DEV.
- //
uint64_t app_id;
explicit
@@ -144,34 +138,6 @@ namespace brep
gh_pull_request () = default;
};
- // @@ TODO Move these functions below the remaining structs?
-
- // Return the GitHub check run status corresponding to a build_state.
- //
- string
- gh_to_status (build_state);
-
- // Return the build_state corresponding to a GitHub check run status
- // string. Throw invalid_argument if the passed status was invalid.
- //
- build_state
- gh_from_status (const string&);
-
- // If warning_success is true, then map result_status::warning to `SUCCESS`
- // and to `FAILURE` otherwise.
- //
- // Throw invalid_argument in case of unsupported result_status value
- // (currently skip, interrupt).
- //
- string
- gh_to_conclusion (result_status, bool warning_success);
-
- // Create a check_run name from a build. If the second argument is not
- // NULL, return an abbreviated id if possible.
- //
- string
- gh_check_run_name (const build&, const build_queued_hints* = nullptr);
-
// The repository member of various webhook events.
//
struct gh_repository
@@ -266,6 +232,32 @@ namespace brep
gh_installation_access_token () = default;
};
+ // Return the GitHub check run status corresponding to a build_state.
+ //
+ string
+ gh_to_status (build_state);
+
+ // Return the build_state corresponding to a GitHub check run status
+ // string. Throw invalid_argument if the passed status was invalid.
+ //
+ build_state
+ gh_from_status (const string&);
+
+ // If warning_success is true, then map result_status::warning to `SUCCESS`
+ // and to `FAILURE` otherwise.
+ //
+ // Throw invalid_argument in case of unsupported result_status value
+ // (currently skip, interrupt).
+ //
+ string
+ gh_to_conclusion (result_status, bool warning_success);
+
+ // Create a check_run name from a build. If the second argument is not
+ // NULL, return an abbreviated id if possible.
+ //
+ string
+ gh_check_run_name (const build&, const build_queued_hints* = nullptr);
+
// Throw system_error if the conversion fails due to underlying operating
// system errors.
//
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 737d93d..65f8c94 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -228,7 +228,7 @@ namespace brep
// Process the `app-id` and `warning` webhook request query parameters.
//
- uint64_t app_id;
+ uint64_t app_id; // @@ string
bool warning_success;
{
const name_values& rps (rq.parameters (1024, true /* url_only */));
@@ -311,6 +311,8 @@ namespace brep
// It's unclear under what circumstances the app_id can be null but it
// shouldn't happen unless something is broken.
//
+ // @@ Move to parsing, make non-optional.
+ //
if (!cs.check_suite.app_id)
throw invalid_request (400, "absent app.id in check_suite webhook");
@@ -2952,7 +2954,7 @@ namespace brep
//
jwt = brep::generate_jwt (
*options_,
- options_->ci_github_app_id_private_key ()[ai],
+ options_->ci_github_app_id_private_key ()[ai], // @@ Lookup and fail.
ai,
chrono::seconds (options_->ci_github_jwt_validity_period ()),
chrono::seconds (60));