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: handle merge_group event - get squashed commit #806

Merged

Conversation

YossiSaadi
Copy link
Contributor

@YossiSaadi YossiSaadi commented Dec 8, 2024

Support for GitHub Merge Queue (merge_group Event)

Summary

This pull request adds support for GitHub's merge queue functionality by handling the merge_group event in the commitlint-github-action. It enables users who utilize GitHub's merge queue feature to lint commit messages effectively during the merge process.
Resolve #744 #757

Changes

  1. Update action.mjs and tests to Support merge_group Event:
  • Added logic to detect when the action is triggered by a merge_group event.
  • Updated the way commits are retrieved in this context to ensure the correct commits are linted.
  • Verified that the correct commits are being linted in this context.
  1. Update README
  • Added a new section on using the action with GitHub Merge Queues:
    • Provided examples of workflows that listen to the merge_group event.
    • Explained necessary configurations and considerations when using the merge queue.

Testing

I've tested the updated action extensively to ensure it works correctly with the merge_group event.

Test Repository: yossi-test-org/test-merge-queue
Test Pull Request: PR #24

Test Steps

  1. Set Up Merge Queue:
  • Enabled the merge queue feature in the test repository.
  • Configured branch protection rules to require the commitlint status check.
  1. Created Workflows:
  • Added a workflow that listens to the merge_group event and runs the commitlint action.
  • Added a placeholder workflow for the pull_request event with a job named commitlint to satisfy merge queue requirements.
  1. Tested Pull Requests:
  • Opened pull request with various commit messages to test linting behavior.
  • Added pull request to the merge queue to trigger the merge_group event.
  1. Verified Action Execution:
  • Confirmed that the commitlint action runs successfully during the merge_group event on the squashed commit.
  • Checked that the action lints the correct commit and reports any issues appropriately.

For testing I also pushed the image to a container registry and ran the workflow against it (https://github.com/users/YossiSaadi/packages/container/package/commitlint-github-action)

@YossiSaadi
Copy link
Contributor Author

Hey @wagoid,
making sure you've seen it
for the meantime I'm using my fork with my dockerfile and it looks ok

Copy link
Owner

@wagoid wagoid left a comment

Choose a reason for hiding this comment

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

Amazing work @YossiSaadi! 🌟
Thanks for the testes and detailed documentation

@wagoid wagoid merged commit 473595d into wagoid:master Dec 16, 2024
2 checks passed
wagoid pushed a commit that referenced this pull request Dec 16, 2024
* feat: handle merge_group event - get squashed commit

* test: merge_group event

* chore: temporarily change docker image

* Revert "chore: temporarily change docker image"

This reverts commit 39350ef.

* docs: update merge_group event support
@YossiSaadi YossiSaadi deleted the feat/support-merge_group-event-squashed-commit branch December 26, 2024 08:47
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.

feature request: predict squash-merge commit on target branch and lint it as well
2 participants