Skip to content
Merged
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
63 changes: 63 additions & 0 deletions .github/workflows/pr-name-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: pr-name-lint
on:
push:
branches:
- main-*
merge_group:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
branches-ignore:
- "[0-9]+.[0-9]+"

jobs:
pr_name_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@v6.1.0
name: Install Node.js
with:
node-version: 16
- name: Install dependencies
run: |
npm install @commitlint/lint@18.6.1 @commitlint/load@18.6.1 @commitlint/config-conventional@18.6.2 @actions/core
- name: Lint PR name
uses: actions/github-script@v8.0.0
# Only validate on pull requests
if: github.event_name == 'pull_request'
with:
script: |
const load = require('@commitlint/load').default;
const lint = require('@commitlint/lint').default;

const CONFIG = {
extends: ['./commitlint.config.js'],
};

const title = context.payload.pull_request.title;

core.info(`Linting: ${title}`);

load(CONFIG)
.then((opts) => {
lint(
title,
opts.rules,
opts.parserPreset ? {parserOpts: opts.parserPreset.parserOpts} : {}
).then((report) => {
report.warnings.forEach((warning) => {
core.warning(warning.message);
});

report.errors.forEach((error) => {
core.error(error.message);
});

if (!report.valid) {
core.setFailed("PR title linting failed");
}
});
});
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ Development happens on [GitHub](https://github.com/ccfos/huatuo) and contributio

## Developer Certificate of Origin

The HUATUO project requires that all contributions to project repositories carry the Developer Certificate of Origin. This is as simple as appending a footer to your commits:
The HUATUO project requires that all contributions to project repositories carry the Developer Certificate of Origin. This is as simple as appending a footer to your commits, a standard commit message is as follows:

```
fix: resolve authentication bug

The login token was not being validated properly.

Closes #123

Signed-off-by: Your Name <name@example.org>
```

Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']}