Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add PR title checker workflow and thank-you comment on merge #1385

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/pr-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 🎉 PR closed

on:
pull_request_target:
types:
- closed

permissions:
contents: read
pull-requests: write

jobs:
thank-you:
runs-on: ubuntu-latest
steps:
- name: Post Thank You Comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
comment: |
## Merge Successful

Your pull request has been successfully merged. We greatly appreciate your time and effort in making this project better! 💪

Happy coding! ✨
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.comment
})
26 changes: 26 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ✅ Check PR Title

on:
pull_request:
types: [opened, edited]

jobs:
lint-pr-title:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# Only fetch the config file from the repository
sparse-checkout-cone-mode: false
sparse-checkout: commitlint.config.js

- name: Install dependencies
run: npm install --global @commitlint/config-conventional commitlint

- name: Check PR title with commitlint
env:
PR_TITLE: ${{ github.event.pull_request.title }}
HELP_URL: https://github.com/wxt-dev/wxt/blob/main/CONTRIBUTING.md#conventional-pull-request-titles
run: echo "$PR_TITLE" | npx commitlint --help-url $HELP_URL
12 changes: 9 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ If you are changing the docs or fixing a bug, feel free to fork and open a PR.

If you want to add a new feature, please create an issue or discussion first so we can decide if the feature is inline with the vision for WXT.

## Conventional Commits
## Conventional Pull Request Titles

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.
The title of your pull request should follow the [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/). 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.

Maintainers, commits to the `main` branch (either directly or via PRs) must be valid conventional commits.
Here are some examples of conventional PR titles:

- `feat: add new functionality`
- `fix: correct typos in code`
- `ci: add GitHub Actions for automated testing`

Generating the changelog based on the commit messages saves time and helps to keep the changelog up-to-date. It also helps to understand the changes in the project.

## Setup

Expand Down
15 changes: 15 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @type {import('@commitlint/types').UserConfig}
*/
const config = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [
0,
'always',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
},
};

module.exports = config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@aklinker1/buildc": "^1.1.4",
"@aklinker1/check": "^1.4.5",
"@commitlint/types": "^19.5.0",
"@types/fs-extra": "^11.0.4",
"@vitest/coverage-v8": "^2.1.4",
"changelogen": "^0.5.7",
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.