mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
ci: add conventional commit PR title linting (#23096)
Restore PR title validation that was removed in 828f33a when
cdr-bot was expected to handle it. That bot has since been disabled.
The new title job in contrib.yaml validates:
- Conventional commit format (type(scope): description)
- Type from the same set used by release notes generation
- Scope validity derived from the changed files in the PR diff
- All changed files fall under the declared scope
Uses actions/github-script (no third-party marketplace actions).
Also fixes feat(api) examples across docs (no api folder exists)
and consolidates commit rules into CONTRIBUTING.md as the single
source of truth.
This commit is contained in:
@@ -247,8 +247,13 @@ characters long (no more than 72).
|
||||
|
||||
Examples:
|
||||
|
||||
- Good: `feat(api): add feature X`
|
||||
- Bad: `feat(api): added feature X` (past tense)
|
||||
- Good: `feat(coderd): add feature X`
|
||||
- Bad: `feat(coderd): added feature X` (past tense)
|
||||
|
||||
Scopes must reference a real path in the repository (a directory or file stem)
|
||||
and must contain all changed files. For example, use `coderd/database` if all
|
||||
changes are within that directory. If changes span multiple top-level
|
||||
directories, omit the scope.
|
||||
|
||||
A good rule of thumb for writing good commit messages is to recite:
|
||||
[If applied, this commit will ...](https://reflectoring.io/meaningful-commit-messages/).
|
||||
@@ -263,7 +268,7 @@ to use the original commit title instead of the PR title.
|
||||
Breaking changes can be triggered in two ways:
|
||||
|
||||
- Add `!` to the commit message title, e.g.
|
||||
`feat(api)!: remove deprecated endpoint /test`
|
||||
`feat(coderd)!: remove deprecated endpoint /test`
|
||||
- Add the
|
||||
[`release/breaking`](https://github.com/coder/coder/issues?q=sort%3Aupdated-desc+label%3Arelease%2Fbreaking)
|
||||
label to a PR that has, or will be, merged into `main`.
|
||||
|
||||
Reference in New Issue
Block a user