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

Add job forbid-merge-commits to .github/workflows/pull-request.yml. #1693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

motlin
Copy link
Contributor

@motlin motlin commented Sep 1, 2024

We recently had a "backwards" merge commit land on the master branch.

It's visible in the git history as the white arrow here.

Screenshot 2024-09-01 at 9 35 17 AM

I wrote and open sourced a GitHub Action to prevent this sort of thing. Its README has more details about why this is a problem and how folks get into this situation. When it happens, the error message is pretty helpful about how to fix up git history.

@@ -298,3 +298,9 @@ jobs:
MAVEN_OPTS: "-Xmx2g"
- name: 'Clean Maven cache'
run: rm -rf ~/.m2/repository/org/eclipse/collections

forbid-merge-commits:
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not entirely sure if it will immediately be evident to the contributor what their next steps are if this action fails - is it possible to include a section regarding the rebase steps in the contributing guidelines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the check fails, it leaves instructions on how to fix the problem. I can't demonstrate it on this repository until it lands, but I could demonstrate it in another repository if that would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's what it looks like when the action fails.

From the Checks Summary

From the Build Logs

@motlin motlin force-pushed the forbid-merge-commits branch 3 times, most recently from 2c6503f to 54a7008 Compare September 15, 2024 20:05
@motlin motlin force-pushed the forbid-merge-commits branch 3 times, most recently from 69ac0b9 to cdb0319 Compare September 29, 2024 17:49
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.

2 participants