Skip to content

feat: add --output-merge-conflicts flag for CI/CD#1903

Open
mfbx9da4 wants to merge 1 commit intomainfrom
feat/output-merge-conflicts
Open

feat: add --output-merge-conflicts flag for CI/CD#1903
mfbx9da4 wants to merge 1 commit intomainfrom
feat/output-merge-conflicts

Conversation

@mfbx9da4
Copy link
Copy Markdown
Contributor

Summary

  • Adds --output-merge-conflicts flag to speakeasy run that writes merge conflict markers to files and continues instead of failing when persistent edit conflicts are detected
  • When the flag is set, resolves the git index conflict state (stages 1/2/3 → stage 0) so files with conflict markers can be committed by the GitHub Action
  • Renders a yellow warning box (instead of red error) and emits ::warning annotations (instead of ::error) for GitHub Actions

Details

Problem: During CI/CD, when persistent edits (custom code) encounter merge conflicts, the CLI errors out and tells the user to resolve conflicts locally. This prevents the GitHub Action from committing the changes.

Solution: With --output-merge-conflicts, the CLI:

  1. Writes files with conflict markers to disk (already done by generator)
  2. Resolves the git conflict state so files are committable (ResolveConflictState)
  3. Logs a warning instead of an error
  4. Exits successfully so the GitHub Action can commit conflicted files to a PR

Files changed:

File Change
cmd/run.go Add OutputMergeConflicts flag and thread to workflow opts
internal/run/workflow.go Add field + WithOutputMergeConflicts opt func
internal/run/target.go Pass to GenerateOptions
internal/sdkgen/sdkgen.go Modify conflict handling, add renderConflictsWarning, adjust success message
internal/git/plumbing.go Add ResolveConflictState (go-git + native git paths)

Test plan

  • Run existing patches integration tests to ensure no regressions
  • Test generation without flag — conflicts still produce errors (unchanged behavior)
  • Test generation with --output-merge-conflicts against a known conflict scenario:
    • Files have conflict markers on disk
    • git status shows modified (not conflicted) files
    • Exit code is 0
    • Warning message is printed (not error)

🤖 Generated with Claude Code

…t conflicts

When persistent edits (custom code) encounters merge conflicts during CI/CD,
the CLI previously errored out requiring local resolution. With the new
--output-merge-conflicts flag, the CLI writes files with conflict markers,
resolves the git conflict state (so files are committable), logs a warning,
and exits successfully so the GitHub Action can commit conflicted files to
a PR for the developer to resolve.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant