lucide icon indicating copy to clipboard operation
lucide copied to clipboard

Enforce conventional PR titles

Open jguddas opened this issue 11 months ago • 4 comments

Originally posted by @ericfennis in https://github.com/lucide-icons/lucide/issues/1550#issuecomment-1961947685

Starting with commit/PR name prefixes. This can be simply done by prefixing PR titles by telling what the PR is including. When PR is merged all commits in PR will be squashed and get the name of the PR.

With certaint types and scopes, we determine what we do. Like @jguddas describes in the description. This is based on: https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format

Type

Must be one of the following:

  • fix: A bug fix [PATCH]
  • feat: A new feature [MINOR]
  • icon: A new icon [MINOR]
  • meta: Changes in metadata
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to our CI configuration files and scripts (Github actions)
  • site: Changes to the website
  • docs: Documentation only changes
  • perf: A code change that improves performance [PATCH]
  • refactor: A code change that neither fixes a bug nor adds a feature
  • test: Adding missing tests or correcting existing tests
  • revert: Reverting code changes [PATCH]
  • style: Changes that do not affect the meaning of the code (code formatting)
  • test: Adding missing or correcting existing tests

Scope

The scope should be the name of the icon or a NPM package. The following is the list of supported scopes:

  • {name of an icon}
  • {name of a npm package}
  • no-release (which won't trigger a release, see Semantic release repo)

PR titles/commit messages

PR titles / commit messages that are merged to the repo should use this format. (When merging a PR with the format in the title this will automatically added in the commit message)

Examples:

  • Add a new icon
    • icon(arrow-up-down): Add arrow-up-icon
    • icon(arrow-up|arrow-down): Adds arrow icons (multiple)
  • Refactoring/optimizing existing icons
    • refactor(arrow-up-down): Optimize arrow-up-icon
  • Updating metadata
    • meta(arrow-up-down): Adding contributors
  • Add a new feature
    • feat(lucide-react): Adding a feature to Lucide React

We also could automatically change the title of the PR with GitHub actions to fix wrong titles.

Release rules

Default release rules when pushing to the main branch. Only the following types will execute a release:

  • fix
  • feat
  • icon
  • revert
  • perf

Supporting packages and GitHub actions we can use

  • Semantic Release, https://github.com/semantic-release/semantic-release
  • Commit Analyzer. To https://github.com/semantic-release/commit-analyzer?tab=readme-ov-file#options
  • Commit Lint, to check PR titles: https://commitlint.js.org/#/reference-rules

jguddas avatar Feb 23 '24 20:02 jguddas

icon, meta and site should be scope instead of type.

Examples:

fix(icons): closed gap chore(icons): renamed icon feat(icons): added bucket icon fix(site): changed broken link to … feat(site): added about page fix(meta): changed spelling mistake feat(meta): added … category to …

jguddas avatar Feb 23 '24 20:02 jguddas

Release rules

I think it's a bad idea, I would much rather always build all packages and do a diff of the build results and only release when there are changes.

jguddas avatar Feb 23 '24 20:02 jguddas

My vote is for following this spec, not for commits but for the pr title.

https://www.conventionalcommits.org/en/v1.0.0/#specification

jguddas avatar Feb 23 '24 20:02 jguddas

Rule proposal:

If you use touch icons/.svg the scope needs to be icons. If you touch only one, icons/.svg the icon name needs to be included in the title.

jguddas avatar Feb 23 '24 20:02 jguddas