Skip to content

Commit 44dab37

Browse files
okineadevaklinker1
andauthored
ci: Add PR title checker workflow and thank-you comment on merge (#1385)
Co-authored-by: Aaron <[email protected]>
1 parent c4295a4 commit 44dab37

File tree

6 files changed

+135
-2
lines changed

6 files changed

+135
-2
lines changed

.commitlintrc.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extends:
2+
- '@commitlint/config-conventional'
3+
rules:
4+
subject-case:
5+
- 0
6+
- always
7+
- - sentence-case
8+
- start-case
9+
- pascal-case
10+
- upper-case

.github/workflows/pr-closed.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 🎉 PR closed
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- closed
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
thank-you:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Post Thank You Comment
17+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
18+
env:
19+
comment: Thanks for helping make WXT better!
20+
with:
21+
script: |
22+
github.rest.issues.createComment({
23+
issue_number: context.issue.number,
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
body: process.env.comment
27+
})

.github/workflows/pr-title.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: ✅ Check PR Title
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited]
6+
7+
jobs:
8+
lint-pr-title:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
with:
15+
# Only fetch the config file from the repository
16+
sparse-checkout-cone-mode: false
17+
sparse-checkout: .commitlintrc.yml
18+
19+
- name: Install dependencies
20+
run: npm install --global @commitlint/config-conventional commitlint
21+
22+
- name: Check PR title with commitlint
23+
env:
24+
PR_TITLE: ${{ github.event.pull_request.title }}
25+
HELP_URL: https://github.com/wxt-dev/wxt/blob/main/CONTRIBUTING.md#conventional-pr-titles
26+
run: echo "$PR_TITLE" | npx commitlint --help-url $HELP_URL

CONTRIBUTING.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ If you want to add a new feature, please create an issue or discussion first so
88

99
## Conventional Commits
1010

11-
This project uses [Conventional Commits](https://www.conventionalcommits.org/en) to automate versioning. If you're a new contributor, don't worry about this. When you open a PR, a maintainer will change the PR's title so it's in the style of conventional commits, but that's all.
11+
This project uses [Conventional Commit format](https://www.conventionalcommits.org/en/v1.0.0/) to automatically generate a changelog and better understand the changes in the project
1212

13-
Maintainers, commits to the `main` branch (either directly or via PRs) must be valid conventional commits.
13+
Here are some examples of conventional commit messages:
14+
15+
- `feat: add new functionality`
16+
- `fix: correct typos in code`
17+
- `ci: add GitHub Actions for automated testing`
18+
19+
## Conventional PR Titles
20+
21+
The title of your pull request should follow the [conventional commit format](#conventional-commits). When a pull request is merged to the main branch, all changes are going to be squashed into a single commit. The message of this commit will be the title of the pull request. And for every release, the commit messages are used to generate the changelog.
1422

1523
## Setup
1624

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"devDependencies": {
2020
"@aklinker1/buildc": "^1.1.4",
2121
"@aklinker1/check": "^1.4.5",
22+
"@commitlint/config-conventional": "^19.7.1",
23+
"@commitlint/types": "^19.5.0",
2224
"@types/fs-extra": "^11.0.4",
2325
"@vitest/coverage-v8": "^2.1.4",
2426
"changelogen": "^0.5.7",

pnpm-lock.yaml

+60
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)