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

feat: update GitHub Actions Workflow for Merge Conflict #269

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mhmohona
Copy link
Contributor

Description

This PR updates the GitHub Actions workflow to handle merge conflicts and provide auto-rebase functionality.
Here is the workflow shown in below diagram -

flowchart TD
    A[Start: PR Created or Updated] -->|Check for Conflicts| B{Merge Conflicts?}
    B -- Yes --> C[Post Merge Conflict Notification]
    B -- No --> D[End: No Action Required]
    C --> E[Wait for User Action]
    E -->|User comments `/rebase`, `/solve_conflict`, or `/sf`| F[Perform Automatic Rebase]
    F -- Success --> G[Post Success Message and Clean Up Comments]
    F -- Failure --> H[Post Failure Message]
    G --> I[End: Rebase Successful]
    H --> J[End: Rebase Failed, Manual Resolution Required]

Related issue(s) #181

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

left some comments to improve things

please also share some example run of the action, so I can see how it works

.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
**Options to Resolve Conflicts:**
- **Manually:** Resolve the conflicts in your local environment and push the changes.
- **Automated Commands:** Use `/rebase`, `/solve_conflict`, or `/sf` to automatically rebase this PR.
**Good Practices:**
Copy link
Member

Choose a reason for hiding this comment

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

you mean good practice for manual resolution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried to cover this part -

Bonus:
Maybe some tips on what is the best way to solve the merge conflict 🤔 good and bad practices.

.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
.github/workflows/pr-merge-conflict.yml Outdated Show resolved Hide resolved
@derberg
Copy link
Member

derberg commented Mar 11, 2024

@mhmohona do you plan to continue with this one?

@mhmohona
Copy link
Contributor Author

I will, please give me some time.

@derberg
Copy link
Member

derberg commented Apr 30, 2024

@mhmohona do you plan to continue with this one or should we ask community to continue?

@mhmohona mhmohona requested a review from derberg May 8, 2024 03:12
fi
- name: Set Output
id: set_output
run: echo "::set-output name=conflicts::${{ env.conflicts }}"
Copy link
Member

Choose a reason for hiding this comment

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

this way is a long time deprecated method for exposing data from step
also, what is the point of this step if in the previous one you already properly expose conflicts variable?

example from other workflows -> https://github.com/asyncapi/.github/blob/master/.github/workflows/if-nodejs-pr-testing.yml#L35

- Consider using a visual diff tool to clearly see and resolve conflicts.
- Test your changes after resolving to ensure nothing is broken.
For more detailed guidance, refer to your project's contributing guidelines or documentation.
auto-rebase:
Copy link
Member

Choose a reason for hiding this comment

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

is the indentation proper? should't it be a new job instead of part of message?

did you test the workflow somewhere?

uses: actions/github-script@v6
with:
script: |
await github.rest.issues.createComment({
Copy link
Member

Choose a reason for hiding this comment

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

why one time you use marocchino/sticky-pull-request-comment and another manually add comment using GH API?

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.

None yet

3 participants