8000 [12.x] feat(git): add semantic commits script and action for commit standard enforcement by mubbi · Pull Request #56443 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

Conversation

mubbi
Copy link
@mubbi mubbi commented Jul 26, 2025

This pull request introduces a new script and GitHub Actions workflow to validate commit messages for adherence to the Conventional Commits format. The workflow ensures consistency in commit messages across pull requests and pushes, providing feedback directly in the pull request when validation fails.

New GitHub Actions Workflow for Commit Message Validation:

  • Workflow Definition (.github/workflows/commitlint.yml):

    • Added a commitlint workflow triggered on pull requests and pushes to specific branches (12.x, *.x, and master).
    • Validates commit messages using a shell script (bin/commitlint.sh) for both pull requests and the latest commit on pushes.
    • Automatically skips validation for special commits (e.g., those starting with Merge, WIP, or Revert).
  • Pull Request Feedback:

    • Posts a comment on the pull request if validation fails, explaining the issue and providing examples of the expected format.
    • Posts a success comment if all commit messages pass validation, ensuring clear communication.
  • Error Handling and Cleanup:

    • Includes robust error handling for malformed commits and ensures temporary files are cleaned up after execution.

Link to commitlint guide doc Pull Request: laravel/docs#10646

Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@mubbi
Copy link
Author
mubbi commented Jul 26, 2025

commitlint / Validate Commit Messages (using Shell Script) (pull_request) is failling due to repo access for writing the comment. while the commit linting worked fine.

Also someone needs to review and decide from when to enforce this github action because this action will fail for some current pending PRs and commits by other devs.

@mubbi mubbi changed the title Feature/commit semantics workflow feat(git): add semantic commits script and action for commit standard enforcement Jul 26, 2025
@mubbi mubbi changed the title feat(git): add semantic commits script and action for commit standard enforcement [12.x] feat(git): add semantic commits script and action for commit standard enforcement Jul 26, 2025
@GrahamCampbell
Copy link
Collaborator

Thanks for the PR, but we don't use semantic commit conventions - this can be observed by looking over the recent commit history. Candidly, this also seems like a waste of CO2 emissions to run this code on every PR.

@mubbi
Copy link
Author
mubbi commented Jul 26, 2025

Thanks for the PR, but we don't use semantic commit conventions - this can be observed by looking over the recent commit history. Candidly, this also seems like a waste of CO2 emissions to run this code on every PR.

Thanks for the feedback! You’re right that the current commit history doesn’t follow semantic conventions—but I believe that’s exactly why this PR could help.

Semantic commits are becoming a global standard, and they provide long-term benefits like:
• Easier changelog generation
• More meaningful commit history
• Simpler automation for releases and versioning

This GitHub Action itself is lightweight (takes just 5–10 seconds) and only runs on PRs, so the CI impact is minimal. It enforces consistency without adding significant overhead.

Of course, if the team prefers not to go this route, I totally understand and can close the PR. Just wanted to propose this as a small improvement that could support scalability and collaboration in the long run. Happy to adjust based on what the team decides.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@mubbi
Copy link
Author
mubbi commented Jul 28, 2025

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

Thanks for the feedback!

Totally understand the need to keep the framework lean and maintainable. To make this functionality available to the community, I've published it as a standalone Laravel package: laravel-commit-lint.
It provides an easy way to enforce semantic commit messages in Laravel projects using a simple git hook.

Hope it’s helpful to others! Feedback and contributions are welcome.

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.

3 participants

0