#[cfg(not(target_arch = "wasm32"))]
use tracing::instrument;
#[cfg(not(target_arch = "wasm32"))]
use crate::auth::TokenProvider;
use crate::error::AptuError;
#[cfg(not(target_arch = "wasm32"))]
use crate::github::auth::create_client_from_provider;
#[cfg(not(target_arch = "wasm32"))]
#[instrument(skip(provider), fields(owner = %owner, repo = %repo, head = %head_branch, base = %base_branch))]
#[allow(clippy::too_many_arguments)]
pub async fn create_pr(
provider: &dyn TokenProvider,
owner: &str,
repo: &str,
title: &str,
base_branch: &str,
head_branch: &str,
body: Option<&str>,
draft: bool,
) -> crate::Result<crate::github::pulls::PrCreateResult> {
let client = create_client_from_provider(provider)?;
crate::github::pulls::create_pull_request(
&client,
owner,
repo,
title,
head_branch,
base_branch,
body,
draft,
)
.await
.map_err(|e| AptuError::GitHub {
message: e.to_string(),
})
}
#[cfg(target_arch = "wasm32")]
pub async fn create_pr(
_provider: &dyn crate::auth::TokenProvider,
_owner: &str,
_repo: &str,
_title: &str,
_base_branch: &str,
_head_branch: &str,
_body: Option<&str>,
_draft: bool,
) -> crate::Result<crate::github::pulls::PrCreateResult> {
crate::facade::wasm_unsupported!("create_pr");
}