Skip to content

Conversation

@cheese-cakee
Copy link

@cheese-cakee cheese-cakee commented Dec 5, 2025

Description:
Updates the merge conflict detection workflow to recognize conflicts caused by updates to the main branch. Previously, the bot only notified users if the PR itself was updated, missing conflicts caused by external changes in main.

Changes:

  • Updated workflow triggers to detect when main updates.
  • Ensures users are notified of merge conflicts even if they haven't touched their PR recently.

Related issue(s):
Fixes #913

Notes for reviewer:
This addresses the edge case where a PR becomes conflicted due to changes in the base branch, ensuring the author is still notified.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Hi @cheese-cakee
Great! Much better, I can work with this - nice one!

One issue I think is that we will never see a failed merge conflict workflow
Right now, you get an X if you have a merge conflict.

By extending it to loop through all issues on push to main, and not letting it fail, we are always going to pass that check, I think.

We want:
✅ If a PR has merge conflicts → its workflow run should fail
✅ If main is updated (push to main) → any PR that now conflicts should also fail in its workflow
✅ No duplicate bot commenting

How can we do that?

@cheese-cakee
Copy link
Author

Thanks for the feedback!

Here is my plan to address the three requirements:

For individual PRs: I'll make sure the script exits with an error code (exit 1) if a conflict is found. That will give us the red ❌ immediately on the PR.

For the loop on main: Since we don't want to fail the workflow running on main itself, I think the best move is to use the GitHub Status API to target the specific PR commit and mark it as failed.

For the spam: I'll simply add a check to scan for previous bot comments before posting a new one.

Please let me know what you think about this.

@exploreriii
Copy link
Contributor

excellent ideas!

@cheese-cakee
Copy link
Author

am i allowed to switch the implementation from the Bash script to actions/github-script

@exploreriii
Copy link
Contributor

if you are making big changes i would like it to be tested well please 👍

@cheese-cakee
Copy link
Author

I have refactored the logic to use actions/github-script and tested all edge cases in my fork.

Test Results:

PR Checks: Conflicted PRs correctly fail the workflow run (Red ❌) and receive a comment.

Push to Main: When a push occurs, the bot scans open PRs and updates their commit status to "Failure" via the API without failing the main workflow run.

No Spam: The bot checks for existing comments and does not double-post.
Screenshot 2025-12-05 231913
Screenshot 2025-12-05 230020
Screenshot 2025-12-05 225835

@cheese-cakee
Copy link
Author

cheese-cakee commented Dec 6, 2025

also if there are any new issues i would love to work on them ! @exploreriii

@exploreriii
Copy link
Contributor

I am reviewing this currently but we have 4 concurrent bot PRs to review.
Request help to review @MonaaEid @tech0priyanshu @AntonioCeppellini @Adityarya11 if available

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Hi @cheese-cakee
Thank you for this - there are many good things here, and might solve the issue!

However you have refactored the logic almost entirely so we cannot go and assume this new bot will work

Therefore, the key thing if you do want to submit this, I want to see you test this on your origin fork

  1. merge it to main
  2. create a pull request 1 with a merge conflict - bot should post
  3. create a pull request 2 without a merge conflict - it should not post
  4. merge soemthing to main that causes a merge conflcit to pull request 2 - it should now post
  5. check maximum nubmer of merge conflict posts is 2

Unfortunately, there are quite a few things to test and it is important to do so otherwise we can risk spamming users and sending incorrect messages

Happy for you to go ahead with this issue if you'd like to do that, however, if you do not want to take on the full work (would be quite a bit to test) happy to reassign or even take it on myself.

@cheese-cakee
Copy link
Author

Hi @exploreriii and @MonaaEid , thanks a lot for the detailed feedback !

I definitely want to see this through and implement the refactor + testing myself. I agree that moving the logic to a script and running the 5-step test plan is the right move for stability.

If you agree, I will work on these changes and run the full test suite on my fork over the next day or two. I'll ping you here with the results once it's ready.

@exploreriii exploreriii marked this pull request as draft December 7, 2025 19:43
@exploreriii
Copy link
Contributor

excellent news! have switched this to draft while its ready to review again

@cheese-cakee cheese-cakee force-pushed the merge-conflict-bot-main-trigger branch from 7fd14a3 to b7f8b99 Compare December 8, 2025 19:47
@cheese-cakee cheese-cakee reopened this Dec 9, 2025
@cheese-cakee
Copy link
Author

cheese-cakee commented Dec 9, 2025

Hi @exploreriii

I have updated the bot based on the feedback.

Changes Made:

Moved the helper script to .github/scripts/merge_conflict_helpers.js as requested.

Updated the workflow yaml to dynamically locate the script using GITHUB_WORKSPACE, ensuring it works regardless of the runner's path structure.

Testing Verification: I have tested this thoroughly on my fork.

Test 1(Conflict Detected): Verified that the bot successfully detects a conflict and comments on the PR.
Test 2 (No Conflict): Verified that the bot remains silent when there are no conflicts.

Screenshot 2025-12-09 153256 Screenshot 2025-12-09 015659

@cheese-cakee cheese-cakee marked this pull request as ready for review December 9, 2025 10:23
@exploreriii
Copy link
Contributor

Hi @cheese-cakee were you able to test if

  1. an issue with no conflict
  2. once another issue gets merged
  3. and issue 1 now has a conflict
  4. there is a notification on issue 1?

@exploreriii
Copy link
Contributor

changing to draft while it is ready to review again 👍

@exploreriii exploreriii marked this pull request as draft December 10, 2025 00:00
@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

To assist you, please read:

Thank you for contributing!

From the Hiero Python SDK Team

@cheese-cakee cheese-cakee marked this pull request as ready for review December 10, 2025 19:30
@cheese-cakee
Copy link
Author

cheese-cakee commented Dec 10, 2025

Hi @exploreriii

Yes! I verified this exact scenario in a test PR on my fork.

I opened a PR with no conflicts (Bot was silent).
I pushed a conflicting change to main.
I forced the bot to run again.
The bot successfully detected the new conflict and posted the comment. 🎉

I also updated harden-runner to v2.14.0 (the latest release) and just resolved the merge conflicts that popped up with main.

Ready for review!

@exploreriii
Copy link
Contributor

Request review @AntonioCeppellini @MonaaEid @tech0priyanshu if available

Copy link
Member

@AntonioCeppellini AntonioCeppellini 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 this two points needs to be reviewed

@github-actions
Copy link

Hi, this is WorkflowBot.
Your pull request cannot be merged as it is not passing all our workflow checks.
Please click on each check to review the logs and resolve issues so all checks pass.
To help you:

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Hi @cheese-cakee
Really great you've been able to test it

Could we add one more safety net?

  1. add workflow dispatch, so we can trigger it manually
  2. add a dry run variable accepting 0,1,true,false,yes,no
    when triggered manually, defeault to dry mode 1
    when run on dry mode, it should log to console merge conflict messages instead of comment

Also, you'll need a changelog entry!

@exploreriii exploreriii marked this pull request as draft December 13, 2025 09:57
@exploreriii
Copy link
Contributor

Hi @cheese-cakee please rebase, the tests are fixed now and there shouldn't be a problem :)

@aceppaluni
Copy link
Contributor

aceppaluni commented Dec 16, 2025

Hi @cheese-cakee I've linked our Rebasing.md file for any assistance you may need.

https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/rebasing.md

Please reach out if you have any questions! We are always happy to help!

@github-actions
Copy link

Hello, this is the Office Hour Bot.

This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 hours (14:00 UTC).

This session provides an opportunity to ask questions regarding this Pull Request or receive assistance from a maintainer.

Details:

Disclaimer: This is an automated reminder. Please verify the schedule here to be notified of any changes.

@aceppaluni
Copy link
Contributor

Hi @cheese-cakee This is looking fantastic!

Here is a link to our documentation on CHANGELOG entries
https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/changelog_entry.md

Below is an example for the changelog entry:
- Updated the merge conflict detection bot to trigger on `main` branch updates and detect conflicts caused by base branch changes. Fixes #913.

I hope this helps!

Please reach out if you have any questions, we are happy to help! :)

Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
@cheese-cakee cheese-cakee force-pushed the merge-conflict-bot-main-trigger branch from af8b9cc to 55122e0 Compare December 19, 2025 21:33
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

[commit-verification-bot]
Hi, this is VerificationBot.
Your pull request cannot be merged as it has unverified commits.
View your commit verification status: Commits Tab.

To achieve verified status, please read:

Remember, you require a GPG key and each commit must be signed with:
git commit -S -s -m "Your message here"

Thank you for contributing!

From the Hiero Python SDK Team

@cheese-cakee
Copy link
Author

I have completed the rebase.do i need to do anything more like in the changelog?

also so sorry for the delay!

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Hi @cheese-cakee great to see you back!
Yes, unfortunately your commits are no longer verified:
https://github.com/hiero-ledger/hiero-sdk-python/pull/970/commits

I would recommend soft reverting them, recommiting with appropriate signatures, then force pushing (first create a backup)

@aceppaluni
Copy link
Contributor

@cheese-cakee If you need assistance with signing your commits, please let us know :)

@github-actions
Copy link

Hi @cheese-cakee,

This pull request has had no commit activity for 10 days. Are you still working on the issue? please push a commit to keep the PR active or it will be closed due to inactivity.
Reach out on discord or join our office hours if you need assistance.

From the Python SDK Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3 Low, backlog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update merge conflict bot to recognise conflicts caused by others

5 participants