Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict_resolution draft_commit_conflicts doesn't open draft PR on empty commit due to conflicts #457

Open
korthout opened this issue Mar 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@korthout
Copy link
Owner

korthout commented Mar 4, 2025

Describe the bug
The experimental conflict_resolution input value draft_commit_conflicts should open a draft PR if there are conflicts. However, if the cherry-picked commit is empty then no draft PR is opened.

To Reproduce
Steps to reproduce the behavior:

  1. Create and merge a pull request with some changes
  2. Trigger the backport workflow to a branch
  3. Merge the backport PR and delete its branch
  4. Trigger the backport workflow to the same branch again
  5. Notice an error like:

Backport failed for main, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin main
git worktree add -d .worktree/backport-28924-to-main origin/main
cd .worktree/backport-28924-to-main
git switch --create backport-28924-to-main
git cherry-pick -x 5b7caeed208862b2c601a5905ac5f80f0c1fb67c

Expected behavior

An empty cherry-picked commit indicates that the target branch already contains the changes of the relevant commit.

We can:

  • create a draft PR where the user has to resolve the conflict themselves
    • we should do this on draft_commit_conflicts
  • allow skipping empty commits directly with a new input empty_commits: skip|fail similar to merge_commits

Workflow run logs
If available, add logs from the workflow run where you noticed this bug to help explain your problem.

Workflow run logs

2025-03-03T23:39:01.3451789Z Retrieve pull request data for #28924
2025-03-03T23:39:01.7536243Z Check whether pull request 28924 is merged
2025-03-03T23:39:01.8797684Z Determining target branches...
2025-03-03T23:39:01.8798448Z Detected labels on PR: backport main,component/zeebe
2025-03-03T23:39:01.8800613Z label 'component/zeebe' doesn't match `label_pattern` '^backport ([^ ]+)$'
2025-03-03T23:39:01.8801595Z Found target branches in labels: main
2025-03-03T23:39:01.8802193Z Found target branches in `target_branches` input: 
2025-03-03T23:39:01.8803295Z Exclude pull request's headref from target branches: backport-28865-to-stable/8.7
2025-03-03T23:39:01.8804323Z Determined target branches: main
2025-03-03T23:39:01.8805149Z Fetching all the commits from the pull request: 2
2025-03-03T23:39:01.8805864Z git fetch --depth=2 origin refs/pull/28924/head
2025-03-03T23:39:02.5441897Z From https://github.com/camunda/camunda
2025-03-03T23:39:02.5442644Z  * branch              refs/pull/28924/head -> FETCH_HEAD
2025-03-03T23:39:02.5486813Z Retrieving the commits from pull request 28924
2025-03-03T23:39:02.8993460Z PR was merged using a merge commit
2025-03-03T23:39:02.8994267Z Found commits to backport: 5b7caeed208862b2c601a5905ac5f80f0c1fb67c
2025-03-03T23:39:02.9002268Z Checking the merged pull request for merge commits
2025-03-03T23:39:02.9003271Z git rev-list --merges 5b7caeed208862b2c601a5905ac5f80f0c1fb67c^..5b7caeed208862b2c601a5905ac5f80f0c1fb67c
2025-03-03T23:39:02.9041776Z Encountered 0 merge commits
2025-03-03T23:39:02.9043078Z Will cherry-pick the following commits: 5b7caeed208862b2c601a5905ac5f80f0c1fb67c
2025-03-03T23:39:02.9043917Z Will copy labels matching undefined. Found matching labels: 
2025-03-03T23:39:02.9044604Z Backporting to target branch 'main...'
2025-03-03T23:39:02.9045107Z git fetch --depth=1 origin main
2025-03-03T23:39:07.6986785Z From https://github.com/camunda/camunda
2025-03-03T23:39:07.6987552Z  * branch              main       -> FETCH_HEAD
2025-03-03T23:39:07.6989741Z  * [new branch]        main       -> origin/main
2025-03-03T23:39:07.7031529Z Start backport to backport-28924-to-main
2025-03-03T23:39:07.7032652Z git switch -c backport-28924-to-main origin/main
2025-03-03T23:39:08.5261444Z Switched to a new branch 'backport-28924-to-main'
2025-03-03T23:39:08.5312517Z git cherry-pick -x 5b7caeed208862b2c601a5905ac5f80f0c1fb67c
2025-03-03T23:39:09.3163533Z The previous cherry-pick is now empty, possibly due to conflict resolution.
2025-03-03T23:39:09.3165009Z If you wish to commit it anyway, use:
2025-03-03T23:39:09.3165418Z 
2025-03-03T23:39:09.3165620Z     git commit --allow-empty
2025-03-03T23:39:09.3165948Z 
2025-03-03T23:39:09.3166210Z Otherwise, please use 'git cherry-pick --skip'
2025-03-03T23:39:09.3207079Z git commit --all -m BACKPORT-CONFLICT
2025-03-03T23:39:09.4098126Z The previous cherry-pick is now empty, possibly due to conflict resolution.
2025-03-03T23:39:09.4098985Z If you wish to commit it anyway, use:
2025-03-03T23:39:09.4099963Z 
2025-03-03T23:39:09.4100253Z     git commit --allow-empty
2025-03-03T23:39:09.4100754Z 
2025-03-03T23:39:09.4103947Z Otherwise, please use 'git cherry-pick --skip'
2025-03-03T23:39:09.4117598Z git cherry-pick --abort
2025-03-03T23:39:09.4366056Z Backport failed for `main`, because it was unable to cherry-pick the commit(s).
2025-03-03T23:39:09.4366673Z 
2025-03-03T23:39:09.4366982Z Please cherry-pick the changes locally and resolve any conflicts.
2025-03-03T23:39:09.4367584Z ```bash
2025-03-03T23:39:09.4367902Z git fetch origin main
2025-03-03T23:39:09.4368434Z git worktree add -d .worktree/backport-28924-to-main origin/main
2025-03-03T23:39:09.4369071Z cd .worktree/backport-28924-to-main
2025-03-03T23:39:09.4369568Z git switch --create backport-28924-to-main
2025-03-03T23:39:09.4370617Z git cherry-pick -x 5b7caeed208862b2c601a5905ac5f80f0c1fb67c
2025-03-03T23:39:09.4371390Z ```
2025-03-03T23:39:09.4372036Z Create comment: Backport failed for `main`, because it was unable to cherry-pick the commit(s).
2025-03-03T23:39:09.4372672Z 
2025-03-03T23:39:09.4372998Z Please cherry-pick the changes locally and resolve any conflicts.
2025-03-03T23:39:09.4373605Z ```bash
2025-03-03T23:39:09.4373926Z git fetch origin main
2025-03-03T23:39:09.4374433Z git worktree add -d .worktree/backport-28924-to-main origin/main
2025-03-03T23:39:09.4375046Z cd .worktree/backport-28924-to-main
2025-03-03T23:39:09.4375529Z git switch --create backport-28924-to-main
2025-03-03T23:39:09.4376118Z git cherry-pick -x 5b7caeed208862b2c601a5905ac5f80f0c1fb67c
2025-03-03T23:39:09.4376669Z

Additional context

@korthout korthout added the bug Something isn't working label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant