Skip to main content

autom8/gh/
types.rs

1//! Core types for GitHub PR operations.
2
3/// Information about an open pull request
4#[derive(Debug, Clone, PartialEq)]
5pub struct PullRequestInfo {
6    /// PR number
7    pub number: u32,
8    /// PR title
9    pub title: String,
10    /// Head branch name (the source branch)
11    pub head_branch: String,
12    /// PR URL
13    pub url: String,
14}
15
16/// Result of attempting to detect a PR for the current branch
17#[derive(Debug, Clone, PartialEq)]
18pub enum PRDetectionResult {
19    /// Found a PR for the current branch
20    Found(PullRequestInfo),
21    /// Current branch is main/master with no PR
22    OnMainBranch,
23    /// On a feature branch but no open PR exists for it
24    NoPRForBranch(String),
25    /// Error occurred during detection
26    Error(String),
27}
28
29/// Result type for PR creation operations
30#[derive(Debug, Clone, PartialEq)]
31pub enum PRResult {
32    /// PR created successfully, contains PR URL
33    Success(String),
34    /// Prerequisites not met, contains reason for skip
35    Skipped(String),
36    /// PR already exists for branch, contains existing PR URL
37    AlreadyExists(String),
38    /// PR description updated successfully, contains PR URL
39    Updated(String),
40    /// PR creation attempted but failed, contains error message
41    Error(String),
42}