Skip to content

Add configurable git section to root config mirroring repver's git automation#3

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/mirror-pull-request-configuration
Draft

Add configurable git section to root config mirroring repver's git automation#3
Copilot wants to merge 4 commits intomainfrom
copilot/mirror-pull-request-configuration

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

Mirrors the git automation configuration from repver into the root config, enabling control over commit messages, push behavior, remote, PR creation method, branch cleanup, and checkout restore.

Config changes (internal/config/root.go)

  • New GitConfig struct nested under git: key with fields: branch_prefix, commit_message, bootstrap_commit_message, push, remote, pull_request (NO/GITHUB_CLI), pr_title, pr_body, bootstrap_pr_title, bootstrap_pr_body, return_to_original_branch, delete_branch
  • Backward-compatible: legacy top-level branch_prefix and create_pr fields are migrated into git section at load time; git section takes precedence
  • Validation mirrors repver constraints: pull_request: GITHUB_CLI requires push: true; delete_branch requires return_to_original_branch: true

Command changes (internal/cmd/apply.go, bootstrap.go)

  • Commit messages, push, PR creation, checkout restore, and branch deletion now driven by config instead of hardcoded
  • Push and return-to-branch are conditional on their respective config bools

GitOps changes (internal/gitops/gitops.go)

  • Push() now accepts a remote parameter instead of hardcoding "origin"
  • Added DeleteBranch() for local branch cleanup

Example config

config_repo: config-repo
git:
  branch_prefix: gitrepoforge/
  commit_message: "gitrepoforge: apply desired state"
  bootstrap_commit_message: "gitrepoforge: bootstrap repo"
  push: true
  remote: origin
  pull_request: GITHUB_CLI
  return_to_original_branch: true
  delete_branch: true

Tests

11 new test cases covering full git section parsing, all defaults, backward compatibility migration, precedence, and validation rejection of invalid combinations.

Docs

Updated root-config.md, gitops.md, and commands.md to reflect the new git section and all configurable behaviors.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits March 10, 2026 23:46
Introduce GitConfig struct mirroring the repver application's git
configuration. RootConfig now uses a nested Git field instead of
top-level BranchPrefix and CreatePR. A rawRootConfig handles backward
compatibility by migrating deprecated fields. Defaults, validation, and
PR constants (PullRequestNo, PullRequestGitHubCLI) are included.

Updated apply.go, bootstrap.go, and config_test.go to use the new
rootCfg.Git.* paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add nested git section to root config with configurable branch prefix,
commit messages, push behavior, remote, pull request creation method,
PR titles/bodies, return to original branch, and branch deletion.
Maintain backward compatibility with legacy branch_prefix and create_pr
top-level fields. Add validation rules matching repver constraints.
Update apply and bootstrap commands to use new config fields.
Parameterize gitops.Push with configurable remote, add DeleteBranch.

Co-authored-by: JaredHatfield <208119+JaredHatfield@users.noreply.github.com>
Update root-config.md, gitops.md, and commands.md to document the
new git section, all configurable fields, validation rules, and
backward compatibility with legacy top-level fields.

Co-authored-by: JaredHatfield <208119+JaredHatfield@users.noreply.github.com>
Copilot AI changed the title [WIP] Add configuration for automating pull requests Add configurable git section to root config mirroring repver's git automation Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants