Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Command for PrCommand {
async move {
(
repo.name.clone(),
github::create_pull_request(&repo, &pr_options).await,
github::create_pr_from_workspace(&repo, &pr_options).await,
)
}
})
Expand All @@ -88,7 +88,7 @@ impl Command for PrCommand {
}
} else {
for repo in repositories {
match github::create_pull_request(&repo, &pr_options).await {
match github::create_pr_from_workspace(&repo, &pr_options).await {
Ok(_) => successful += 1,
Err(e) => {
eprintln!(
Expand Down
9 changes: 7 additions & 2 deletions src/github/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ use anyhow::Result;
use colored::*;
use uuid::Uuid;

/// Create a pull request for a repository
pub async fn create_pull_request(repo: &Repository, options: &PrOptions) -> Result<()> {
/// High-level function to create a PR from local changes
///
/// This function encapsulates the entire pull request creation flow:
/// 1. Check for changes in the workspace
/// 2. Create branch, add, commit, and push changes
/// 3. Create GitHub PR via API
pub async fn create_pr_from_workspace(repo: &Repository, options: &PrOptions) -> Result<()> {
let repo_path = repo.get_target_dir();

// Check if repository has changes
Expand Down
2 changes: 1 addition & 1 deletion src/github/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub mod client;
pub mod types;

// Re-export commonly used items for convenience
pub use api::create_pull_request;
pub use api::create_pr_from_workspace;
pub use auth::GitHubAuth;
pub use client::GitHubClient;
pub use types::{PrOptions, PullRequestParams};
Expand Down
4 changes: 2 additions & 2 deletions tests/github_api_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! GitHub API tests focusing on PR creation functionality

use repos::config::Repository;
use repos::github::api::create_pull_request;
use repos::github::api::create_pr_from_workspace;
use repos::github::types::PrOptions;
use std::fs;
use std::path::PathBuf;
Expand Down Expand Up @@ -54,7 +54,7 @@ async fn test_create_pull_request_no_changes() {
);

// Should succeed with no changes (just prints a message and returns Ok)
let result = create_pull_request(&repo, &options).await;
let result = create_pr_from_workspace(&repo, &options).await;
assert!(result.is_ok());
}

Expand Down
Loading