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

.github/workflows: Add workflow to address merge conflicts #2958

Closed
wants to merge 7 commits into from
16 changes: 16 additions & 0 deletions .github/workflows/check-merge-conflicts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Check merge conflicts"
on:
push:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need push?

Copy link
Contributor

Choose a reason for hiding this comment

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

There won't be an github.event.pull_request for push events!

Copy link
Member Author

Choose a reason for hiding this comment

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

Why do we need push?

This action runs on every push and checks all pending PR's for merge conflicts, see https://github.com/jxs/rust-libp2p/actions/runs/3158064326/jobs/5139673243

There won't be an github.event.pull_request for push events!

Yeah found out here 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

But why do we need to run it on push?

Shouldn't synchronize happen every time HEAD or base changes? I guess one is always subscribed to a PR that you created so we don't necessarily need to tag the author, I'd be kinda nice though.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still an open point for me @jxs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, that is a bit of a concern, we usually have lots of PRs open. @elenaf9 @mxinden @jxs Could I get your opinion on #3010? Happy for you to also suggest other tools but mergify could give us quite a bit of automation like closing stale PRs.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, you already have a workflow for closing up stale PRs - https://github.com/libp2p/rust-libp2p/blob/master/.github/workflows/stale.yml It's currently closing only those that need author input and have no activity.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also checked https://github.com/eps1lon/actions-label-merge-conflict/blob/main/sources/main.ts. It doesn't check out each PR branch. It uses the API to check on the mergeability status of all PRs. So the approach they're taking seems correct and it should work just fine for this repo. We can investigate further and contribute back to the project if it turns out it doesn't.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah nice then, thanks @galargh!

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, you already have a workflow for closing up stale PRs - master/.github/workflows/stale.yml It's currently closing only those that need author input and have no activity.

Interesting! haha

I wasn't aware at all and should probably go buy some glasses as I've completely overlooked that one all this time when I was working on the workflows!

We also don't really seem to use it / the label. We should probably keep that one then and just remove the label requirement so we don't have to explicitly tag PRs for it to run.

pull_request_target:
types: [synchronize]

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: check if prs are dirty
uses: eps1lon/actions-label-merge-conflict@releases/2.x
with:
dirtyLabel: "merge-conflicts"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: "Hey ${{ github.event.pull_request.user.login }} This pull request has conflicts, please resolve the merge conflicts with the base branch before we can continue reviewing. Thanks!"
elenaf9 marked this conversation as resolved.
Show resolved Hide resolved