diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-19 14:10:25 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-19 16:15:28 +0200 |
commit | 7f851c8c3789f745bdf7d07546084be224c714fb (patch) | |
tree | 3ae89e12ffcd0b8f975185bd14941d8c96e84728 | |
parent | 953648c40b29cf1c8a338782038507399d1adcd8 (diff) |
ci-github: handle_check_run_rerequest(): get IAT earlier
-rw-r--r-- | mod/mod-ci-github.cxx | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 3f685f1..cbd8e70 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -946,6 +946,9 @@ namespace brep bcr.name = cr.check_run.name; ccr.name = conclusion_check_run_name; + const gh_installation_access_token* iat (nullptr); + optional<gh_installation_access_token> new_iat; + // Load the service data, failing the check runs if the tenant has been // archived. // @@ -974,14 +977,22 @@ namespace brep tenant_id = d->tenant_id; - if (d->archived) // Tenant is archived + // Get a new IAT if the one from the service data has expired. + // + if (system_clock::now () > sd.installation_access.expires_at) { - // Fail (re-create) the check runs. - // - optional<gh_installation_access_token> iat (get_iat ()); - if (!iat) + if ((new_iat = get_iat ())) + iat = &*new_iat; + else throw server_error (); + } + else + iat = &sd.installation_access; + if (d->archived) // Tenant is archived + { + // Fail the check runs. + // gq_built_result br ( make_built_result ( result_status::error, warning_success, @@ -1040,21 +1051,6 @@ namespace brep } } - // Get a new IAT if the one from the service data has expired. - // - const gh_installation_access_token* iat (nullptr); - optional<gh_installation_access_token> new_iat; - - if (system_clock::now () > sd.installation_access.expires_at) - { - if ((new_iat = get_iat ())) - iat = &*new_iat; - else - throw server_error (); - } - else - iat = &sd.installation_access; - // Fail if it's the conclusion check run that is being re-requested. // // @@ TMP When user selects re-run all failed checks we receive multiple |