A Ruleset with Metadata Restrictions on Commit Messages should not block Squash Merge Pull Requests unless the sqash commit message itself violates the rule #108531
-
Select Topic AreaBug BodyI have a Ruleset which puts a regex restriction on commit messages. I have a commit in my pull request which violates the Ruleset rule with Metadata Restrictions on commit messages. The rule only applies to the main branch and I am making a PR from a feature branch to the main branch. I would expect this to still allow sqaush merging but the option is disabled. When doing a squash merge you are presented with an editor which will prepend the PR title and allow you to edit the final commit message which will be the actual commit message that is merged to the protected branch. I would expect the metadata rule to apply to the final commit message only and not block squash merging unless the rule fails on that message, not each individual commit. |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 9 replies
-
|
This is definitely a thing that I'd like to have enforced as expected. In the interim, I can work around this to update the ruleset to apply to all branches, but for with a squash merge, only that commit message should matter. Getting this to work as expected would reduce the burden on a developer to use conventional commits before pushing to a PR branch, and, if forgotten, they wouldn't need to go back and rewrite their commits. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
Just ran into this and have had to abandon the idea as a result. I would also expect only the squashed commit to be subject to this rule as its the thing that actually gets put on the target branch, |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
Is there any workaround for this? For squash and merge the individual commits wont be visible in the main branch, so we don't actually care about those with this type of protection. We only care about the title of the PR, and if that follows the rule then squash and merge should be possible. |
Beta Was this translation helpful? Give feedback.
-
|
The workaround is to not use a Rulset for this but to just create an action which does a regular expression check right in the action. |
Beta Was this translation helpful? Give feedback.
-
|
This issue has impacted our team as well. We support this suggestion to only block on the final squash commit message. |
Beta Was this translation helpful? Give feedback.
-
|
We would benefit from this change too. The ruleset should not block squash merges based on individual commit messages. |
Beta Was this translation helpful? Give feedback.
-
|
Workaround using ci is really bad and overkill on lot activity repos, need some trigger in rulesets about squash merges |
Beta Was this translation helpful? Give feedback.
-
|
i don't know why such a popular request (not the first time it appears) is being ignored this much! |
Beta Was this translation helpful? Give feedback.
-
|
Whelp, this is a shame. It makes the commit rules completely unusable for us. I guess we'll continue with our GitHub Action to validate the PR title instead. Shame the GitHub developers didn't consider something as simple as a squash merge. Who on earth would want to enforce such conventions on every single commit in a PR? It defeats the whole purpose of a PR! Might as well have everyone committing directly to master if not. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
This is still valid, we're still waiting on someone from github to fix it. |
Beta Was this translation helpful? Give feedback.
-
|
It sucks that the commit message restriction requires an enterprise plan but we don't get enterprise support 👎🏼 |
Beta Was this translation helpful? Give feedback.
-
|
Hello, |
Beta Was this translation helpful? Give feedback.
-
|
Hi @justinmchase |
Beta Was this translation helpful? Give feedback.
-
|
what a shame, I also just ran into this (and this is the first google result one gets). The marked answer really does not solve the underlying problem. The PR title is part of the review, so if it's wrong the reviewer is expected to flag that. What we really want to ensure is the commits on release branches so they can be parsed for semantic releases. Some implementations (python-semantic-release) fail when they encounter a non-conforming commit, others ignore it. Luckily we just switched to one that ignores it, but it's still an issue for release note creation! I guess we can have a PR check for title conformity, plus a push-triggered workflow to verify after the fact and flag it for a maintainer to consider whether it's egregious enough to warrant changing the history of main, or manually fix the changelog. |
Beta Was this translation helpful? Give feedback.



The workaround is to not use a Rulset for this but to just create an action which does a regular expression check right in the action.