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

Function stageWorkflowChanges

pkg/cli/git.go:313–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

311}
312
313func stageWorkflowChanges() {
314 // Find git root and add .github/workflows relative to it
315 if gitRoot, err := gitutil.FindGitRoot(); err == nil {
316 workflowsPath := filepath.Join(gitRoot, constants.WorkflowsDirSlash)
317 _ = exec.Command("git", "-C", gitRoot, "add", workflowsPath).Run()
318
319 // Also stage .gitattributes if it was modified
320 _ = stageGitAttributesIfChanged()
321 } else {
322 // Fallback to relative path if git root can't be found
323 _ = exec.Command("git", "add", constants.WorkflowsDirSlash).Run()
324 _ = exec.Command("git", "add", ".gitattributes").Run()
325 }
326}
327
328// ensureGitAttributes ensures that .gitattributes contains the entry to mark .lock.yml files as generated.
329// It returns true if the file was modified, false if it was already up to date.

Callers 2

RemoveWorkflowsFunction · 0.85
TestStageWorkflowChangesFunction · 0.85

Calls 3

FindGitRootFunction · 0.92
RunMethod · 0.45

Tested by 1

TestStageWorkflowChangesFunction · 0.68