Skip to content

Allow specifying a custom branch for locating .pr_agent.toml #1977

@alvarogl

Description

@alvarogl

Feature request

Add an option to control which Git branch the tool inspects when searching for the .pr_agent.toml configuration file. By default, the tool currently only looks in the repository’s default branch (e.g. main or master). We’d like to be able to override this—either via:

  • A CLI flag (e.g. --config-branch <branch-name>),
  • An environment variable (e.g. PR_AGENT_CONFIG_BRANCH),
  • Or by falling back to the PR’s source branch before the default branch.

When provided, the tool should attempt to load .pr_agent.toml from the specified branch; if the file is not found there, it can then fall back to the default behavior or emit a clear warning/error.

Motivation

  • Isolated experimentation: When testing new models, fine-tuning parameters, or iterating on configuration, it’s useful to keep those experimental files on a feature branch rather than clutter the main branch.
  • Clean default branch: Prevents temporary or exploratory configuration files from being merged into the primary branch, reducing merge noise and accidental commits.
  • Flexible workflows: Teams may have multiple environments (staging, QA, production) represented by different branches; being able to point PR-Agent at the correct branch config makes it easier to mirror real-world conditions.
  • Consistency with other tools: Many CI/CD and build systems allow overriding the config branch; providing the same flexibility here aligns PR-Agent with existing developer expectations.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions