Repository navigation
feat(actions): lint pull request titles and commits with commitlint - #47
Merged
Merged
Conversation
ci-pr checked messages with check-conventional-commit.sh, a regex that accepts any scope, while this repo's own hooks used commitlint. pr-checks now installs commitlint from its own lockfile and lints against commitlint.default.yaml plus the rules of the caller's .commitlintrc.yaml, so a repository can make its scopes binding. Only rules is read from the caller's file, and commitlint runs from an empty directory, so a pull request still cannot get code executed. The script stays for the conventional-commit pre-commit hook until consumers move.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ci-prchecked titles and commits withcheck-conventional-commit.sh, a regex that accepts any scope. This repo's own hooks used commitlint. So there were two definitions of a valid commit, and no project's scope list was enforced.pr-checksnow:npm cifrom its ownpackage-lock.json(no install scripts, runner's Node);commitlint.default.yaml, which matches what the script accepted (known type, optional lowercase scope, a description,!allowed);rulesof the caller's.commitlintrc.yamlwhen it has one, so a repository can make its scopes binding.A repository with no
.commitlintrc.yamlis held to the same rules as before.Security
A commitlint config can name JavaScript through
extends,pluginsandparserPreset.lint.mjsreads onlyrulesfrom the caller's file, writes its own config, and runs commitlint from an empty directory, so a pull request still cannot get code executed.test-hooks.shhas a case for it.Not in this PR
check-conventional-commit.shand theconventional-commitpre-commit hook stay until the consumers have moved off them.commitlint.config.mjsis not read byci-pr; converting it to.commitlintrc.yamlcomes with the mise change.Tested
bash .devtools/test-hooks.sh: all pass, including 15 new cases forlint.mjs.prettier --check .,actionlint,shellcheck,check-action-pins.sh: clean.node_modules.self-pron this PR exercises it same-repo; a consumer draft PR pointed at this branch is still needed before merge, asAGENTS.mdasks. Draft until then.