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: Enforce conventional commit format in PR title #398

Merged
merged 3 commits into from
Oct 1, 2024
Merged

Conversation

augustebaum
Copy link
Contributor

@augustebaum augustebaum commented Sep 24, 2024

  • Add commitlint workflow to lint the PR title (not the individual PR commits)
  • Make sentence-case the only allowed PR title format (first letter must be capitalized, like "Merge commit ..." or "Revert commit ...")

Closes #66

@augustebaum augustebaum changed the title add commitlint Workflow ci: add commitlint workflow Sep 24, 2024
@augustebaum augustebaum changed the title ci: add commitlint workflow ci: enforce conventional commit format in PR titles Sep 24, 2024
@augustebaum augustebaum changed the title ci: enforce conventional commit format in PR titles ci: Enforce conventional commit format in PR titles Sep 24, 2024
@thomass-dev thomass-dev self-requested a review September 24, 2024 14:36
@augustebaum augustebaum changed the title ci: Enforce conventional commit format in PR titles ci: enforce conventional commit format in PR titles Sep 24, 2024
@augustebaum augustebaum changed the title ci: enforce conventional commit format in PR titles hello: enforce conventional commit format in PR titles Sep 24, 2024
@augustebaum augustebaum changed the title hello: enforce conventional commit format in PR titles ci: enforce conventional commit format in PR titles Sep 24, 2024
@augustebaum augustebaum changed the title ci: enforce conventional commit format in PR titles ci: Enforce conventional commit format in PR titles Sep 24, 2024
@augustebaum augustebaum marked this pull request as ready for review September 24, 2024 15:55
Copy link
Collaborator

@thomass-dev thomass-dev left a comment

Choose a reason for hiding this comment

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

My question is: since we impose to squash commits before merging, the user has a dialog box to define the squash-commit message. He can therefore easily override this PR title rule. Is this really relevant?

I welcome the initiative, but IMHO, i think it's premature and should be done at the commits level.

.github/workflows/lint-pr-title.yml Outdated Show resolved Hide resolved
@tuscland
Copy link
Member

I love this! Can we mention expected rules in the contributing guide?

@augustebaum
Copy link
Contributor Author

augustebaum commented Sep 27, 2024

He can therefore easily override this PR title rule.

This is a good point; I will do some research to see how to deal with this. In the meantime, only people with write access to the repo (i.e. the Probabl product team) can do this when merging a PR, so as long we're minimally disciplined I don't think that's an issue

@augustebaum
Copy link
Contributor Author

it should be done at the commits level.

You mean check individual commits inside a PR? I don't mind, it just heavily increases dev friction and in the end all the commits are squashed

@augustebaum
Copy link
Contributor Author

it's premature

This is a pre-requisite for proper release management, e.g. for updating the changelog automatically. It's a simple change, and it will immediately make our main branch cleaner.

@thomass-dev
Copy link
Collaborator

thomass-dev commented Sep 27, 2024

He can therefore easily override this PR title rule.

This is a good point; I will do some research to see how to deal with this. In the meantime, only people with write access to the repo (i.e. the Probabl product team) can do this when merging a PR, so as long we're minimally disciplined I don't think that's an issue

Time for joke: if we're disciplined, we don't need such a test, since only the maintainers can merge a PR and therefore edit the merge-commit message and respect the convention :) .

I'm truly convinced that if we want to base an automatic release management on conventional commits, we need to add some strong rules that can't be ignored. To err is human.


I don't know if its possible to run a workflow after squashing but before merging.

@tuscland
Copy link
Member

I agree with @thomass-dev. We can start by describing good conventions, exercise them manually and then implement them automatically.

e.g. for updating the changelog automatically

I am not sure. I don't like changelogs based solely on automatically generated statements; they should primarily have an editorial perspective.

@augustebaum
Copy link
Contributor Author

Time for joke: if we're disciplined, we don't need such a test, since only the maintainers can merge a PR and therefore edit the merge-commit message and respect the convention :) .

Obviously, you need much less discipline to not change a green PR message, than to make sure every PR you review abides by a full convention. This is a net positive.

We can start by describing good conventions, exercise them manually and then implement them automatically.

I don't think this convention will be strictly followed unless there are automatic checks for it; furthermore, I don't want to do a job that this PR could easily achieve.

I don't like changelogs based solely on automatically generated statements.

Point taken; taking the list of commits is a first step, that can then be used to write up more digestible updates.

Copy link
Member

@tuscland tuscland left a comment

Choose a reason for hiding this comment

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

Please add a section on conventional commits in the contributing guide, mentioning what they are and what we expect.

@augustebaum augustebaum marked this pull request as draft September 30, 2024 10:47
@augustebaum augustebaum marked this pull request as ready for review September 30, 2024 12:39
Copy link
Member

@tuscland tuscland left a comment

Choose a reason for hiding this comment

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

I second Thomas' request for changes, otherwise all good. Thank you!

@augustebaum augustebaum changed the title ci: Enforce conventional commit format in PR titles hello Sep 30, 2024
@augustebaum augustebaum changed the title hello helloo Sep 30, 2024
@augustebaum augustebaum marked this pull request as draft September 30, 2024 13:55
@augustebaum augustebaum changed the title helloo hellooo Sep 30, 2024
@augustebaum augustebaum changed the title hellooo helloooo Sep 30, 2024
@augustebaum augustebaum changed the title helloooo hellooooo Sep 30, 2024
@augustebaum augustebaum changed the title hellooooo ci: Enforce conventional commit format in PR titles Sep 30, 2024
@augustebaum augustebaum changed the title ci: Enforce conventional commit format in PR titles hello Sep 30, 2024
@augustebaum augustebaum force-pushed the commitlint branch 2 times, most recently from 858bca9 to 1fac371 Compare September 30, 2024 14:31
@augustebaum augustebaum changed the title hello helloo Sep 30, 2024
@augustebaum augustebaum changed the title helloo hellooo Sep 30, 2024
@augustebaum augustebaum changed the title hellooo ci: Enforce conventional commit format in PR titles Sep 30, 2024
tuscland
tuscland previously approved these changes Sep 30, 2024
rouk1
rouk1 previously approved these changes Oct 1, 2024
.commitlintrc.yml Outdated Show resolved Hide resolved
@augustebaum augustebaum dismissed stale reviews from rouk1 and tuscland via dd29452 October 1, 2024 08:32
@augustebaum augustebaum changed the title ci: Enforce conventional commit format in PR titles hello Oct 1, 2024
@augustebaum augustebaum changed the title hello fix: hi Oct 1, 2024
@augustebaum augustebaum changed the title fix: hi ci: Enforce conventional commit format in PR title Oct 1, 2024
Copy link
Collaborator

@thomass-dev thomass-dev left a comment

Choose a reason for hiding this comment

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

Nice work! I like it.

@thomass-dev thomass-dev merged commit 7f9d5a8 into main Oct 1, 2024
2 checks passed
@thomass-dev thomass-dev deleted the commitlint branch October 1, 2024 08:37
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.

Define our commit naming convention and automate its verification
4 participants