From 0e82cd3c0e6c01ebf587f7cd8f08aa5af8cf3407 Mon Sep 17 00:00:00 2001 From: Ahmed Din Date: Wed, 21 Oct 2026 03:27:47 +0500 Subject: [PATCH] chore(ci): add commitlint for conventional commits (#90) - Add commitlint.config.js matching CONTRIBUTING.md types and scopes - Add GitHub Actions workflow .github/workflows/commitlint.yml - Update CHANGELOG.md --- .github/workflows/commitlint.yml | 29 +++++++++++++++++++++++++++++ CHANGELOG.md | 2 ++ commitlint.config.js | 26 ++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .github/workflows/commitlint.yml create mode 100644 commitlint.config.js diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..31ef534 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,29 @@ +name: Commitlint + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: read + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install commitlint + run: npm install --no-save @commitlint/cli@19.6.1 @commitlint/config-conventional@19.6.0 + + - name: Validate PR commits with commitlint + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/CHANGELOG.md b/CHANGELOG.md index 097b5dc..f9f2024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `ci`: Add commitlint configuration (`commitlint.config.js`) and GitHub Actions PR workflow (`.github/workflows/commitlint.yml`) enforcing Conventional Commits and documented scopes (#90). + - `rwa-asset`: holder count tracking (#146). `holder_count()` returns the number of addresses currently holding a strictly positive balance. The counter is incremented when a balance crosses 0 → >0 (first receive) and decremented when a balance hits exactly 0 (full burn or full send). `set_holder_cap(cap)` lets the admin set an optional ceiling on the holder count (Reg D style); any `mint`, `transfer`, `transfer_from` or `forced_transfer` that would add a new holder when the count already equals the cap is rejected with `ExceedsHolderCap` (error 25). `holder_count_cap()` returns the configured ceiling or `None`. The new `HolderCapSet` event is emitted by `set_holder_cap`, including when the cap is removed. A property test (`tests/test_holder_count.rs`) verifies the invariant `holder_count == count(addresses with balance > 0)` after every step in a 50-operation sequence of mints, burns, and transfers, both with and without an active cap. - `rwa-asset`: `set_governance`, `propose_cap_increase`/`approve_cap_increase`/`cancel_cap_increase` and `pending_cap_increase`. `update_metadata` still refuses to loosen a supply cap by itself (IR-02); raising one now requires the admin to propose a value and a separately configured `governance` address to approve it, mirroring `propose_admin`/`accept_admin`'s two-step shape. See [ADR-007](docs/architecture/007-governance-controlled-supply-cap.md) for why this is a second address rather than the `governance` contract itself (#148). diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..46c5fef --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,26 @@ +module.exports = { + extends: ["@commitlint/config-conventional"], + rules: { + "type-enum": [ + 2, + "always", + ["feat", "fix", "docs", "test", "refactor", "chore", "perf"], + ], + "scope-enum": [ + 2, + "always", + [ + "rwa-asset", + "registry", + "compliance", + "governance", + "oracle-adapter", + "sdk", + "ci", + "docs", + "readme", + ], + ], + "header-max-length": [2, "always", 72], + }, +};