reconcile

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

Reconcile Package

The package in this folder helps to reconcile a target branch with a source branch.

Usage

coco reconcile \
  --source <source_branch> \
  --target <target_branch> \
  --owner <owner_name> \
  --repo <repo_name> \

For the reconcile command usage please run

coco reconcile --help

Command Details

flowchart TB
    st[Start]
    e[End]
    op1[[Set sourceBranch, targetBranch, owner and repo]]
    op2[[Authenticate with Github]]
    op3[[Attempt to merge branches]]
    cond3{Merge conflict detected?}
    cond5{reconcileBranch exists?}
    cond6{targetBranch has new commits?}
    cond6_1{Delete the reconcileBranch or <br> manually rebase with targetBranch?}
    io6_1[/reconcileBranch deleted/]
    cond7{Is the draft pull request mergeable?}
    io7_1[/Fast-forward merge of reconcileBranch into targetBranch/]
    io7_2[/Resolve merge conflicts and re-try/]
    op8[[Create a new reconcileBranch]]
    op9[[Create a new draft pull request]]
    io9[/Resolve merge conflicts in the pull request and re-try/]

    st-->op1-->op2-->op3-->cond3
    op8-->op9-->io9-->e
    cond3-->|YES|cond5
    cond3-->|NO|e
    cond5-->|YES|cond6
    cond5-->|NO|op8
    cond6-->|YES|cond6_1
    cond6-->|NO|cond7
    cond6_1-->|DELETE|io6_1-->op8
    cond6_1-->|REBASE MANUALLY|e
    cond7-->|YES|io7_1-->e
    cond7-->|NO|io7_2-->e

Authentication

For pushing to Github, this command requires access to a GitHub personal access token. The token must be stored in the GITHUB_TOKEN environment variable.

Example

coco reconcile --source main --target dev --owner myorg --repo myrepo

This will reconcile the origin/dev branch with the origin/main branch in the myorg/myrepo repository. If there are merge conflicts, it will create a new branch named reconcile/main-dev from the origin/dev branch, and then attempt to merge the origin/main branch into it. If there are no merge conflicts, it will merge the origin/main branch into the origin/dev branch directly.

sequenceDiagram
    User->>Coco: Run reconcile command
    Coco->>Github: Switch to origin/dev branch
    Coco->>Github: Attempt merging origin/main
    Github-->>Coco: Return merge result
    Coco-->>Coco: Handle merge result
    Coco-->>User: Coco exits gracefully

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.5.0

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	sourceBranch, targetBranch, owner, repo, token, githubBaseURL string,
	logger Logger,
) (*Client, error)

func (*Client) Reconcile added in v1.5.0

func (r *Client) Reconcile(force bool) error

type Logger added in v1.4.1

type Logger interface {
	Info(args ...interface{})
	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL