Skip to content

Commit de20b03

Browse files
committed
chore: add commit policy
1 parent 427950a commit de20b03

4 files changed

Lines changed: 70 additions & 0 deletions

File tree

.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
@@ -11,6 +11,8 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
1416

1517
- name: Configure JDK
1618
uses: actions/setup-java@v4
@@ -37,6 +39,14 @@ jobs:
3739
run: |
3840
npm install -g markdownlint-cli
3941
markdownlint README.md
42+
43+
- name: Lint branch commits with commitlint
44+
if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
45+
run: |
46+
npm install -g @commitlint/config-conventional @commitlint/cli
47+
commitlint --verbose \
48+
--from $(git merge-base origin/${{ github.event.repository.default_branch }} ${{ github.sha }}) \
49+
--to ${{ github.sha }}
4050
4151
unit-tests:
4252
runs-on: ubuntu-latest

CONTRIBUTING.md

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

0 commit comments

Comments
 (0)