copy

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkflowPaths = []string{".github/workflows"}
	ActionsPaths  = []string{".github/actions"}
	CopilotPaths  = []string{
		".github/copilot-instructions.md",
		".github/copilot",
	}
	GitHubDirPath = []string{".github"}
	// CodeOwnersPaths are always removed because CODEOWNERS references
	// teams/users that typically don't exist in the target org.
	CodeOwnersPaths = []string{
		"CODEOWNERS",
		".github/CODEOWNERS",
		"docs/CODEOWNERS",
	}
)

Well-known path sets for preset exclusion flags.

Functions

func BuildExcludePaths

func BuildExcludePaths(noWorkflows, noActions, noCopilot, noGitHub bool, extraPaths []string) ([]string, error)

BuildExcludePaths merges preset flags, user-supplied --exclude paths, and always-excluded paths (CODEOWNERS) into a single deduplicated list. When noGitHub is true, it supersedes noWorkflows, noActions, and noCopilot since the entire .github directory is removed.

func CleanTargetReleases

func CleanTargetReleases(src, tgt *ghclient.Client, srcOwner, srcRepo, tgtOwner, tgtRepo string, verbose bool) error

CleanTargetReleases deletes all releases in the target repo that don't exist in the source. Used by --force to prevent orphaned releases after mirror push.

func CleanupExcludedPaths

func CleanupExcludedPaths(host, owner, repo, token string, paths []string, verbose bool) error

CleanupExcludedPaths clones the target repo, removes the specified paths, and pushes a cleanup commit. This is a post-push operation that preserves full history — the cleanup appears as a single new commit.

func CopyIssues

func CopyIssues(src, tgt *ghclient.Client, srcOwner, srcRepo, tgtOwner, tgtRepo string, verbose bool) error

CopyIssues migrates all issues from source to target repository.

func CopyPullRequests

func CopyPullRequests(src, tgt *ghclient.Client, srcOwner, srcRepo, tgtOwner, tgtRepo string, verbose bool) error

CopyPullRequests migrates PRs as issues (PRs cannot be recreated via API).

func CopyReleases

func CopyReleases(src, tgt *ghclient.Client, srcOwner, srcRepo, tgtOwner, tgtRepo string, verbose bool) error

CopyReleases migrates all releases and their assets from source to target.

func CopyWiki

func CopyWiki(srcHost, srcOwner, srcName, tgtHost, tgtOrg, tgtName, srcToken, tgtToken string, verbose bool) error

CopyWiki clones and pushes the wiki repository.

func MirrorRepo

func MirrorRepo(srcHost, srcOwner, srcName, tgtHost, tgtOrg, tgtName, srcToken, tgtToken string, lfs, forceOverwrite, codeOnly, verbose bool) ([]string, error)

MirrorRepo performs a bare clone from source and pushes to target. forceOverwrite: uses --mirror (destructive). codeOnly: pushes only branches (no tags). Default (both false): pushes branches + new tags (additive). Returns the list of rejected refs (e.g. "refs/heads/main") if any branches were rejected by the remote due to branch protection or org rulesets.

func SyncReleases

func SyncReleases(src, tgt *ghclient.Client, srcOwner, srcRepo, tgtOwner, tgtRepo string, verbose bool) error

SyncReleases copies only releases that don't already exist in the target. Existing releases in the target are preserved.

Types

This section is empty.

Jump to

Keyboard shortcuts

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