Skip to content

Commit 105808c

Browse files
authored
chore: only apply commit convention to PR titles (#88)
1 parent 02b8113 commit 105808c

File tree

7 files changed

+13
-108
lines changed

7 files changed

+13
-108
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
### Before submitting the PR, please make sure you do the following
2121

2222
- [ ] Read the [Contributing Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md).
23-
- [ ] Read the [Pull Request Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md#pull-request-guidelines) and follow the [Commit Convention](https://github.com/vitejs/vite-plugin-react/blob/main/.github/commit-convention.md).
23+
- [ ] Read the [Pull Request Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md#pull-request-guidelines) and follow the [PR Title Convention](https://github.com/vitejs/vite-plugin-react/blob/main/.github/commit-convention.md).
2424
- [ ] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
2525
- [ ] Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`).
2626
- [ ] Ideally, include relevant tests that fail without this PR but pass with it.

.github/commit-convention.md

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,21 @@ Messages must be matched by the following regex:
88

99
<!-- prettier-ignore -->
1010
```js
11-
/^(revert: )?(feat|fix|docs|dx|refactor|perf|test|workflow|build|ci|chore|types|wip|release|deps)(\(.+\))?: .{1,50}/
11+
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore)(\(.+\))?!?: .{1,50}/
1212
```
1313

1414
#### Examples
1515

16-
Appears under "Features" header, `dev` subheader:
17-
1816
```
1917
feat(dev): add 'comments' option
20-
```
21-
22-
Appears under "Bug Fixes" header, `dev` subheader, with a link to issue #28:
23-
24-
```
2518
fix(dev): fix dev error
26-
27-
close #28
28-
```
29-
30-
Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation:
31-
32-
```
33-
perf(build): remove 'foo' option
34-
35-
BREAKING CHANGE: The 'foo' option has been removed.
36-
```
37-
38-
The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header.
39-
40-
```
19+
perf(build)!: remove 'foo' option
4120
revert: feat(compiler): add 'comments' option
42-
43-
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
44-
```
45-
46-
### Full Message Format
47-
48-
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**:
49-
50-
```
51-
<type>(<scope>): <subject>
52-
<BLANK LINE>
53-
<body>
54-
<BLANK LINE>
55-
<footer>
5621
```
5722

58-
The **header** is mandatory and the **scope** of the header is optional.
59-
6023
### Revert
6124

62-
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body, it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
63-
64-
### Type
65-
66-
If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However, if there is any [BREAKING CHANGE](#footer), the commit will always appear in the changelog.
67-
68-
Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`, `style`, `refactor`, and `test` for non-changelog related tasks.
25+
If the PR reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit
6926

7027
### Scope
7128

@@ -78,15 +35,3 @@ The subject contains a succinct description of the change:
7835
- use the imperative, present tense: "change" not "changed" nor "changes"
7936
- don't capitalize the first letter
8037
- no dot (.) at the end
81-
82-
### Body
83-
84-
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
85-
The body should include the motivation for the change and contrast this with previous behavior.
86-
87-
### Footer
88-
89-
The footer should contain any information about **Breaking Changes** and is also the place to
90-
reference GitHub issues that this commit **Closes**.
91-
92-
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.

.github/semantic.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/semantic-pull-request.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@ jobs:
1515
steps:
1616
- name: Validate PR title
1717
uses: amannn/action-semantic-pull-request@v5
18+
with:
19+
subjectPattern: ^(?![A-Z]).+$
20+
subjectPatternError: |
21+
The subject "{subject}" found in the pull request title "{title}"
22+
didn't match the configured pattern. Please ensure that the subject
23+
doesn't start with an uppercase character.
1824
env:
1925
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ This repo is a monorepo using pnpm workspaces. The package manager used to insta
2727

2828
- Make sure tests pass!
2929

30-
- Commit messages must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated. Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)).
31-
3230
- No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)).
3331

32+
- PR title must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated.
33+
3434
## Running Tests
3535

3636
### Integration Tests

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
"vitest": "^0.27.3"
6666
},
6767
"simple-git-hooks": {
68-
"pre-commit": "pnpm exec lint-staged --concurrent false",
69-
"commit-msg": "pnpm exec tsx scripts/verifyCommit.ts $1"
68+
"pre-commit": "pnpm exec lint-staged --concurrent false"
7069
},
7170
"lint-staged": {
7271
"*": [

scripts/verifyCommit.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)