diff --git a/swarm-controller/src/forge.rs b/swarm-controller/src/forge.rs index f45e65d1..d604abea 100644 --- a/swarm-controller/src/forge.rs +++ b/swarm-controller/src/forge.rs @@ -1214,18 +1214,17 @@ impl Client { state: CommitStatusState, description: &str, ) -> Result<()> { + let status = CreateStatusOption { + context: Some(context.to_owned()), + description: Some(status_description(description)), + state: Some(state), + target_url: None, + }; self.api - .repo_create_status( - owner, - repo, - sha, - CreateStatusOption { - context: Some(context.to_owned()), - description: Some(status_description(description)), - state: Some(state), - target_url: None, - }, - ) + .call(|api| { + api.repo_create_status(owner, repo, sha, status.clone()) + .into_future() + }) .await .with_context(|| format!("set the {context} status on {sha} of {owner}/{repo}"))?; Ok(()) diff --git a/swarm-controller/src/forge/builder_account.rs b/swarm-controller/src/forge/builder_account.rs index 57d5e5fb..18330f57 100644 --- a/swarm-controller/src/forge/builder_account.rs +++ b/swarm-controller/src/forge/builder_account.rs @@ -70,7 +70,7 @@ impl Client { self.ensure_builder_user().await?; let team = self.ensure_hives_team().await?; self.api - .org_add_team_member(team, LOGIN) + .call(|api| api.org_add_team_member(team, LOGIN).into_future()) .await .with_context(|| format!("adding {LOGIN} to the hives team"))?; @@ -133,7 +133,7 @@ impl Client { self.create_user(LOGIN, EMAIL).await?; let user = self .api - .user_get(LOGIN) + .call(|api| api.user_get(LOGIN).into_future()) .await .with_context(|| format!("read forge user {LOGIN}"))?; if user.email.as_deref() != Some(EMAIL) { @@ -144,7 +144,10 @@ impl Client { ); } self.api - .admin_edit_user(LOGIN, super::repo_creation_lockdown(LOGIN)) + .call(|api| { + api.admin_edit_user(LOGIN, super::repo_creation_lockdown(LOGIN)) + .into_future() + }) .await .with_context(|| format!("disable repo creation for forge user {LOGIN}"))?; Ok(()) @@ -179,7 +182,11 @@ impl Client { }; let member = match self.observe_hives_team().await { TeamSeen::Matches(id) | TeamSeen::Drifted(id) => { - match self.api.org_list_team_member(id, LOGIN).await { + match self + .api + .call(|api| api.org_list_team_member(id, LOGIN).into_future()) + .await + { Ok(_) => Some(true), Err(e) if is_not_found(&e) => Some(false), Err(e) => {