Skip to main content

label_pr

Function label_pr 

Source
pub async fn label_pr(
    provider: &dyn TokenProvider,
    reference: &str,
    repo_context: Option<&str>,
    dry_run: bool,
    ai_config: &AiConfig,
) -> Result<(u64, String, String, Vec<String>)>
Expand description

Auto-label a pull request based on conventional commit prefix and file paths.

Fetches PR details, extracts labels from title and changed files, and applies them to the PR. Optionally previews without applying.

§Arguments

  • provider - Token provider for GitHub credentials
  • reference - PR reference (URL, owner/repo#number, or bare number)
  • repo_context - Optional repository context for bare numbers
  • dry_run - If true, preview labels without applying

§Returns

Tuple of (pr_number, pr_title, pr_url, labels).

§Errors

Returns an error if:

  • GitHub token is not available from the provider
  • PR cannot be parsed or found
  • API call fails