Skip to content

Commit b935c33

Browse files
committed
chore: add commit policy
1 parent 92d63e9 commit b935c33

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

.commitlintrc.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extends:
2+
- '@commitlint/config-conventional'
3+
4+
rules:
5+
'header-max-length': [2, 'always', 50]
6+
'body-max-line-length': [2, 'always', 72]
7+
'type-enum': [2, 'always', ['feat', 'fix', 'perf', 'refactor', 'test', 'docs', 'ci', 'build', 'chore', 'revert']]

.gitcommit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<type>: <header line up to 50 chars total>
2+
3+
# Explain what & why, wrapped at 72 characters per line.
4+
# Focus on rationale and intent, not implementation details.
5+
6+
# Footer: use only if needed.
7+
# - BREAKING CHANGE: describe incompatible change
8+
# - Other important notes (e.g. migration, deprecation)

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
1214

1315
- name: Set up Flutter
1416
uses: subosito/flutter-action@v2
@@ -30,6 +32,14 @@ jobs:
3032
run: |
3133
npm install -g markdownlint-cli
3234
markdownlint README.md
35+
36+
- name: Lint branch commits with commitlint
37+
if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
38+
run: |
39+
npm install -g @commitlint/config-conventional @commitlint/cli
40+
commitlint --verbose \
41+
--from $(git merge-base origin/${{ github.event.repository.default_branch }} ${{ github.sha }}) \
42+
--to ${{ github.sha }}
3343
3444
tests-android:
3545
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Contributing to MIRACL Trust Flutter Plugin
2+
3+
## Git Commit Policy
4+
5+
> Concise rules for this repository.
6+
> Details: <https://www.conventionalcommits.org/>
7+
### Format
8+
9+
```txt
10+
<type>: <subject>
11+
<body>
12+
<footer>
13+
```
14+
15+
* **type**: use one of:
16+
17+
* `feat` — new feature or change in behaviour (e.g., `feat: add new feature`)
18+
* `fix` — bug fix (e.g., `fix: correct validation logic`)
19+
* `perf` — performance improvement, no behaviour change (e.g., `perf: improve
20+
response time`)
21+
* `refactor` — internal code change, no behaviour change. Includes
22+
formatting-only changes. (e.g., `refactor: reorganise module structure`)
23+
* `test` — adding missing tests or correcting existing tests (e.g., `test: add
24+
smoke test`)
25+
* `docs` — documentation (e.g., `docs: update guide`)
26+
* `ci` — CI configuration/jobs (e.g., `ci: increase job timeout`)
27+
* `build` — build system or artefacts (e.g., `build: update dockerfile`)
28+
* `chore` — maintenance (e.g., `chore: update dependencies`)
29+
* `revert` — revert (e.g., `revert: rollback previous change`)
30+
* **subject**: imperative, no full stop, does not start with a capital letter,
31+
**≤ 50 characters (including type)**
32+
* **body**: wrap at **72 characters**; explain **what & why** (not how)
33+
* **footer**: optional notes
34+
35+
### Commit template
36+
37+
A commit template with 50/72 visual guides is provided in
38+
[.gitcommit](/.gitcommit). Set it with:
39+
40+
```sh
41+
git config commit.template .gitcommit
42+
```

0 commit comments

Comments
 (0)