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

ci: EXPOSED-725 Enforce commit message rules #2396

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

joc-a
Copy link
Collaborator

@joc-a joc-a commented Feb 5, 2025

Detailed description:

  • What:
    Ensure that all commit messages in a pull request, including the pull request's title, adhere to the Conventional Commits specification.
  • Why:
    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.
  • How:
  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.

What you'll see when all commit messages are valid:
Screenshot 2025-02-05 at 5 08 18 PM

What you'll see when some commit messages are invalid:
Screenshot 2025-02-05 at 5 48 50 PM

What you'll see when the PR title is valid:
Screenshot 2025-02-05 at 5 08 29 PM

What you'll see when the PR title is invalid:
Example 1
Screenshot 2025-02-05 at 5 56 04 PM
Example 2
Screenshot 2025-02-05 at 5 54 47 PM


Type of Change

Please mark the relevant options with an "X":

  • Bug fix
  • New feature
  • Documentation update
  • Other - CI

Updates/remove existing public API methods:

  • Is breaking change

Affected databases:

  • MariaDB
  • Mysql5
  • Mysql8
  • Oracle
  • Postgres
  • SqlServer
  • H2
  • SQLite

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)
  • All public methods affected by my PR has up to date API docs
  • Documentation for my change is up to date

Related Issues

@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch 2 times, most recently from 108a4b4 to fe677fd Compare February 5, 2025 14:48
@joc-a joc-a marked this pull request as ready for review February 5, 2025 14:52
@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch 27 times, most recently from 297dd42 to 2f9f9f3 Compare February 5, 2025 16:53
@joc-a joc-a changed the title ci: EXPOSED-725 Enforce commit message rules EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a changed the title EXPOSED-725 Enforce commit message rules ci: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a changed the title ci: EXPOSED-725 Enforce commit message rules random: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch 2 times, most recently from c9c269f to b0c1d74 Compare February 5, 2025 17:29
@joc-a joc-a changed the title random: EXPOSED-725 Enforce commit message rules ci: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch 2 times, most recently from b0c1d74 to fc8df84 Compare February 5, 2025 17:41
@joc-a joc-a changed the title ci: EXPOSED-725 Enforce commit message rules wrong: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a changed the title wrong: EXPOSED-725 Enforce commit message rules ci: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a changed the title ci: EXPOSED-725 Enforce commit message rules wrong: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch from fc8df84 to b767234 Compare February 5, 2025 17:58
@joc-a joc-a changed the title wrong: EXPOSED-725 Enforce commit message rules ci: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a changed the title ci: EXPOSED-725 Enforce commit message rules wrong: EXPOSED-725 Enforce commit message rules Feb 5, 2025
@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch 4 times, most recently from 429575f to 30c9614 Compare February 5, 2025 18:09
@joc-a joc-a changed the title wrong: EXPOSED-725 Enforce commit message rules ci: EXPOSED-725 Enforce commit message rules Feb 5, 2025
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.
@joc-a joc-a force-pushed the joc/enforce-conventional-commits branch from 30c9614 to 5e46cbd Compare February 5, 2025 18:11
@joc-a joc-a requested review from bog-walk and obabichevjb February 6, 2025 10:37
@obabichevjb
Copy link
Collaborator

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?

@joc-a
Copy link
Collaborator Author

joc-a commented Feb 7, 2025

Just to confirm, if a PR has several commits, that rule for commit message would be applied only to the last one, right?

No, it would apply to all the commits.

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?

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

@joc-a joc-a merged commit a32e1f6 into main Feb 7, 2025
10 checks passed
@joc-a joc-a deleted the joc/enforce-conventional-commits branch February 7, 2025 13:36
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