-
Notifications
You must be signed in to change notification settings - Fork 697
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
ci: EXPOSED-725 Enforce commit message rules #2396
Conversation
108a4b4
to
fe677fd
Compare
297dd42
to
2f9f9f3
Compare
c9c269f
to
b0c1d74
Compare
b0c1d74
to
fc8df84
Compare
fc8df84
to
b767234
Compare
429575f
to
30c9614
Compare
1. Added `commit-message-validation.yml` that runs a bash script to check the commit messages using a regular expression. The `validate-commits` job will run when the pull request is first opened and on every push. 2. Added `pull-request-title-validation.yml` that runs a bash script to check the pull request's title using a regular expression. The `validate-PR-title` job will run on every edit of the pull request. It's not possible to isolate this to title edits only at the moment, so edits to other parts like the body and labels will also trigger this workflow.
30c9614
to
5e46cbd
Compare
In general I like that idea, I also sometimes forget about it) Just to confirm, if a PR has several commits, that rule for commit message would be applied only to the last one, right? And there is a moment when we merge the PR. We could squash commits and update the message, that rules wouldn't applied to the new message? |
No, it would apply to all the commits.
Yes, when using "Squash and merge", it is possible to modify the final commit message to something that does not conform to the rules, but this is not something within our control and we cannot enforce it with GitHub Actions as far as I know. There could be something in the repository settings that allows us to do this, but I do not have access to them. Do you? @obabichevjb |
Detailed description:
Ensure that all commit messages in a pull request, including the pull request's title, adhere to the Conventional Commits specification.
The commit message rule is being forgotten sometimes, so it's better to automate this check. Ensuring we adhere to the Conventional Commits specification makes it easier to categorize the commits when preparing the ChangeLog for the release.
commit-message-validation.yml
that runs a bash script to check the commit messages using a regular expression. Thevalidate-commits
job will run when the pull request is first opened and on every push.pull-request-title-validation.yml
that runs a bash script to check the pull request's title using a regular expression. Thevalidate-PR-title
job will run on every edit of the pull request. It's not possible to isolate this to title edits only at the moment, so edits to other parts like the body and labels will also trigger this workflow.What you'll see when all commit messages are valid:
![Screenshot 2025-02-05 at 5 08 18 PM](https://private-user-images.githubusercontent.com/38375996/410415765-387d2175-7be1-4780-b675-6d647f6f162f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODM5ODcsIm5iZiI6MTczOTM4MzY4NywicGF0aCI6Ii8zODM3NTk5Ni80MTA0MTU3NjUtMzg3ZDIxNzUtN2JlMS00NzgwLWI2NzUtNmQ2NDdmNmYxNjJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE4MDgwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyZTBlNDVjMTI3YzMyZDA0OTNjNGU2ZmNkMmM2MDYxODFiNzBjNjg4NWI0ZDEzNjY5OWEzMjE4NjY3OWY1NzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.YXdOSWxe5shk-GFKo76nRVBWePNnTGi1lzq2ORc8Uak)
What you'll see when some commit messages are invalid:
![Screenshot 2025-02-05 at 5 48 50 PM](https://private-user-images.githubusercontent.com/38375996/410415874-1be7905b-28d3-4f96-ac58-69d879ecacb6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODM5ODcsIm5iZiI6MTczOTM4MzY4NywicGF0aCI6Ii8zODM3NTk5Ni80MTA0MTU4NzQtMWJlNzkwNWItMjhkMy00Zjk2LWFjNTgtNjlkODc5ZWNhY2I2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE4MDgwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdkZDg0N2ZkYTU1NjkwODIxMGIyZWE5YmFhOGZjODdhMWNmNDFkM2Q2Yjk0MGRlMWRiYTk0ZDlhMjFmN2U4N2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Blb0rF_ZCBmIl0x26gMdEfWSe73vNU3QKE4T2TGAGXc)
What you'll see when the PR title is valid:
![Screenshot 2025-02-05 at 5 08 29 PM](https://private-user-images.githubusercontent.com/38375996/410416083-3c174502-9664-4790-8f07-fd8f801fd4ea.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODM5ODcsIm5iZiI6MTczOTM4MzY4NywicGF0aCI6Ii8zODM3NTk5Ni80MTA0MTYwODMtM2MxNzQ1MDItOTY2NC00NzkwLThmMDctZmQ4ZjgwMWZkNGVhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE4MDgwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhYmQ4NTM2M2VjODNhMDJkMTFjNjJhYmY4MTcyMTZhMDBiZGYwNzllZGNhZjMyOWYwM2RmZGU1NGJjNWExNTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Dn54i6v5egpGgswN58WAMvGerVdnbZYrUHCIkKEMa_g)
What you'll see when the PR title is invalid:
![Screenshot 2025-02-05 at 5 56 04 PM](https://private-user-images.githubusercontent.com/38375996/410416301-dd189883-7ffa-4cba-adaf-eeae48d4913a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODM5ODcsIm5iZiI6MTczOTM4MzY4NywicGF0aCI6Ii8zODM3NTk5Ni80MTA0MTYzMDEtZGQxODk4ODMtN2ZmYS00Y2JhLWFkYWYtZWVhZTQ4ZDQ5MTNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE4MDgwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ3OTk1ZmQyMzQ2NzE2ODk4YjJkMmE4Zjc3MzhjMzE3NzRhOWM1YTdlOTJmYjBiOGQ1YWYxZDhiMmZmMzY0ODYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.QNI0AzeS8Hxejmh-UxBY7YQUPlcnx6Xg-WcQkrtyspw)
![Screenshot 2025-02-05 at 5 54 47 PM](https://private-user-images.githubusercontent.com/38375996/410416342-37032a24-5775-4243-8488-935500f0185f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODM5ODcsIm5iZiI6MTczOTM4MzY4NywicGF0aCI6Ii8zODM3NTk5Ni80MTA0MTYzNDItMzcwMzJhMjQtNTc3NS00MjQzLTg0ODgtOTM1NTAwZjAxODVmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE4MDgwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNjNDE1YjRlN2FmNTM5ODFjZDM5Nzk0MDEzZGQxZWRmOWFjNTM3NzAxZDljZGYxZTQ0ODkwZjM2M2MyOWI0ZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.tZ2c6L2-yH4XNEwFwrP6-nlG3AjPG00F54wB14eMHN0)
Example 1
Example 2
Type of Change
Please mark the relevant options with an "X":
Updates/remove existing public API methods:
Affected databases:
Checklist
Related Issues