Skip to main content

Module github

Module github 

Source
Expand description

GitHub CLI (gh) integration

Uses gh CLI to query PR information and perform GitHub operations.

§Architecture

This module uses a trait-based design for testability:

§Example: Using in tests

use gw::github::{GitHubClient, MockScenarioBuilder, fixtures};

let executor = MockScenarioBuilder::new()
    .gh_available()
    .with_pr("feature/test", &fixtures::open_pr(42, "feature/test"))
    .build();

let client = GitHubClient::with_executor(executor);
let pr = client.get_pr_for_branch("feature/test").unwrap().unwrap();
assert!(pr.state.is_open());

Modules§

fixtures
Pre-built JSON responses for common PR scenarios

Structs§

CommandCall
A recorded command call for verification
CommandOutput
Output from a command execution
GitHubClient
GitHub client for interacting with GitHub via gh CLI
MockCommandExecutor
Mock command executor for testing
MockScenarioBuilder
Builder for creating mock GitHub scenarios
PrInfo
Information about a PR associated with a branch
RawPrData
Raw PR data from JSON (before merge method detection)
RealCommandExecutor
Real command executor that runs actual shell commands

Enums§

MergeMethod
How a PR was merged
PrState
PR state from GitHub

Traits§

CommandExecutor
Trait for executing shell commands

Functions§

add_pr_comment
Add a comment to a PR
delete_remote_branch
Delete a remote branch
get_pr_for_branch
Get PR information for a branch
is_gh_authenticated
Check if gh is authenticated
is_gh_available
Check if gh CLI is available
update_pr_base
Update PR base branch