Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions pkg/cli/add_interactive_git.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,6 @@ func (c *AddInteractiveConfig) createWorkflowPRAndConfigureSecret(ctx context.Co
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("Secret '%s' added", secretName)))
}

// Step 8d: Update local branch with merged changes from GitHub.
// Switch to the default branch and pull so that workflow files are available
// locally for the subsequent "run workflow" step.
if err := c.updateLocalBranch(); err != nil {
// Non-fatal - warn the user and continue; the workflow exists on GitHub
// even if we can't update the local branch.
addInteractiveLog.Printf("Failed to update local branch: %v", err)
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Could not update local branch: %v", err)))
fmt.Fprintln(os.Stderr, "You may need to switch to your repository's default branch (for example 'main') and run 'git pull' manually before running the workflow.")
}

return nil
}

Expand Down
16 changes: 16 additions & 0 deletions pkg/cli/add_interactive_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ func (c *AddInteractiveConfig) checkStatusAndOfferRun(ctx context.Context) error
if parsed != nil {
fmt.Fprintln(os.Stderr, "")

// Pull the merged workflow files now that we know GitHub has processed the
// merge (workflowFound is true). Doing this here—rather than immediately
// after the PR merge—avoids a race where git fetch runs before GitHub's git
// objects have been updated, which caused "workflow file not found" errors.
if !c.Verbose {
fmt.Fprintln(os.Stderr, "Updating local branch (this may take a few seconds)...")
}
if err := c.updateLocalBranch(); err != nil {
addInteractiveLog.Printf("Failed to update local branch: %v", err)
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Could not update local branch: %v", err)))
fmt.Fprintln(os.Stderr, "You may need to switch to your repository's default branch (for example 'main') and run 'git pull' manually before running the workflow.")
}
if !c.Verbose {
fmt.Fprintln(os.Stderr, "Finished updating local branch.")
}

if err := RunSpecificWorkflowInteractively(ctx, parsed.WorkflowName, c.Verbose, c.EngineOverride, c.RepoOverride, "", false, false, false); err != nil {
fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("Failed to run workflow: %v", err)))
c.showFinalInstructions()
Expand Down
Loading