Skip to content

Conversation

@lbussell
Copy link
Member

@lbussell lbussell commented Oct 22, 2025

Part of dotnet/dotnet-docker#6653.

Background

We want automated backports in dotnet/dotnet-docker, but the repo has hundreds of checked-in files that are generated from templates. The templates often have different output depending on the branch. This means backports frequently create merge conflicts. Regenerating all of the templated files resolves most merge conflicts.

Changes

This PR adds an input to the backport workflow base that lets consuming workflows pass in a command that can be run to try and resolve merge conflicts. If there's a merge conflict, we run the custom conflict resolution command. If all of the merge conflicts/markers are resolved after the command is run, then we proceed with the pull request.

@lbussell lbussell marked this pull request as ready for review October 23, 2025 17:57
@lbussell
Copy link
Member Author

/cc @nagilson for a review of the JavaScript.

The 'Error:' string is automatically added by GitHub's workflow output.
@mthalman mthalman requested a review from Copilot October 23, 2025 18:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an automated conflict resolution mechanism to the backport workflow, allowing consuming repos to specify a custom command that attempts to resolve merge conflicts during automated backports.

Key changes:

  • Adds a conflict_resolution_command input parameter that accepts a shell command to run when merge conflicts occur
  • Implements conflict detection and resolution flow that stages changes, verifies conflicts are resolved, and continues the git am process
  • Refactors error handling to use helper functions with improved GitHub comment formatting

mthalman
mthalman previously approved these changes Oct 23, 2025
@lbussell lbussell requested a review from mthalman October 23, 2025 22:54
@lbussell
Copy link
Member Author

Ready for review again - updated the links to the examples as well.

Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mentioned this is not complete yet, but here are the thoughts I had so far.

@nagilson
Copy link
Member

Looked over it again - the JS looks good to me from what I saw, though I left some feedback. Definitely in favor of this idea! :)

@mmitche mmitche merged commit f11f9fc into dotnet:main Oct 24, 2025
2 of 4 checks passed
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.

4 participants