MCPcopy Create free account
hub / github.com/github/gh-aw / prepareDeployCheckout

Function prepareDeployCheckout

pkg/cli/deploy_command.go:183–205  ·  view source on GitHub ↗
(ctx context.Context, targetRepo string)

Source from the content-addressed store, hash-verified

181}
182
183func prepareDeployCheckout(ctx context.Context, targetRepo string) (string, string, error) {
184 gitRoot, err := gitutil.FindGitRoot()
185 if err != nil {
186 return "", "", fmt.Errorf("deploy command requires running inside a git repository: %w", err)
187 }
188
189 updatesDir, err := ensureUpdateTargetRepoGitignore(gitRoot)
190 if err != nil {
191 return "", "", err
192 }
193
194 checkoutDir := filepath.Join(updatesDir, sanitizeRepoPath(targetRepo))
195 if err := shallowCloneTargetRepo(ctx, targetRepo, checkoutDir); err != nil {
196 return "", "", err
197 }
198
199 originalDir, err := os.Getwd()
200 if err != nil {
201 return "", "", fmt.Errorf("failed to read current directory: %w", err)
202 }
203
204 return checkoutDir, originalDir, nil
205}
206
207func runDeployUpdatePass(ctx context.Context, addOpts AddOptions, coolDown time.Duration) error {
208 if err := PreflightCheckForCreatePR(addOpts.Verbose); err != nil {

Callers 1

runDeployFunction · 0.85

Calls 5

FindGitRootFunction · 0.92
sanitizeRepoPathFunction · 0.85
shallowCloneTargetRepoFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected