From 7960e89dc687cc8d0b1d083cc51b302230a741c0 Mon Sep 17 00:00:00 2001 From: Dr Sohil Momin Date: Mon, 9 Nov 2026 12:08:24 +0000 Subject: [PATCH] ci: check pull-request commits against cog.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Conventional commits are written by hand across this fleet and drift silently. `cog check` now runs on pull requests over the range the PR adds, against the types this repo actually uses — `licence` and `sweep` are declared alongside the standard set, because 52 of the 82 commits written before this gate used a type outside it and a gate that relitigated them would be red on arrival. Advisory (`continue-on-error`) until a few PRs pass through it clean, matching how rustfmt and clippy are already gated here. --- .github/workflows/build-release.yml | 30 +++++++++++++++++++++++++++++ CONTRIBUTING.md | 5 ++++- cog.toml | 29 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 cog.toml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index c16bf94..658a7ed 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -301,3 +301,33 @@ jobs: --- © 2026 Dr. Sohil Momin (drsamonline) — MIT license, attribution required. + + # --------------------------------------------------------------------------- + # Conventional commits — advisory, pull requests only. + # + # Checks the commits the PR adds against the types in `cog.toml`, never the + # history: 52 of the 82 commits written before this gate used a type outside + # the standard set (`licence:`, `sweep:`, title-cased subjects), and a gate + # that relitigates them would be red on arrival and ignored thereafter. + # Promote to blocking once a few PRs have passed through it clean. + # --------------------------------------------------------------------------- + commits: + name: Conventional commits + if: github.event_name == 'pull_request' + continue-on-error: true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # was @v4 + with: + fetch-depth: 0 + + - name: Install cocogitto 7.0.0 + run: | + curl -fsSL -o cog.tar.gz \ + https://github.com/cocogitto/cocogitto/releases/download/7.0.0/cocogitto-7.0.0-x86_64-unknown-linux-musl.tar.gz + tar -xzf cog.tar.gz + sudo install -m 0755 "$(find . -maxdepth 2 -type f -name cog | head -1)" /usr/local/bin/cog + cog --version + + - name: cog check (PR commits only) + run: cog check "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3fe7bb0..1fd26d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,7 +71,10 @@ cargo clippy --all-targets -- -D warnings 4. Watermark every new file (see ground rule 2). 5. Ensure your commit tree contains **no** `target/`, logs, or OS junk (`.gitignore` covers these — don't weaken it). -6. Open the PR against `main`; CI runs automatically. Maintainer review required. +6. Write conventional commit subjects (`feat:`, `fix:`, `docs:`, `ci:`, …; the + full list is in `cog.toml`). The `Conventional commits` job checks the + commits your PR adds — `cog check main..HEAD` reproduces it locally. +7. Open the PR against `main`; CI runs automatically. Maintainer review required. ## Reporting issues diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..59b1323 --- /dev/null +++ b/cog.toml @@ -0,0 +1,29 @@ +# ============================================================================= +# CLDR — cocogitto configuration (conventional commits) +# © 2026 Dr. Sohil Momin (drsamonline). MIT-licensed — retain this notice. +# ============================================================================= +# +# `cog check` runs on every pull request over the commits the PR adds (see the +# `commits` job in .github/workflows/build-release.yml). The type list is this +# repo's own: `licence` and `sweep` are used throughout the history, and +# `release` marks a version bump, so all three are declared here rather than +# being reported as violations. +# +# Local use: cog check main..HEAD +ignore_merge_commits = true + +[commit_types] +feat = { changelog_title = "Features" } +fix = { changelog_title = "Fixes" } +docs = { changelog_title = "Documentation" } +build = { changelog_title = "Build" } +ci = { changelog_title = "CI" } +release = { changelog_title = "Releases" } +chore = { changelog_title = "Chores", omit_from_changelog = true } +licence = { changelog_title = "Licence", omit_from_changelog = true } +sweep = { changelog_title = "Sweeps", omit_from_changelog = true } +refactor = { changelog_title = "Refactoring", omit_from_changelog = true } +test = { changelog_title = "Tests", omit_from_changelog = true } +perf = { changelog_title = "Performance" } +style = { changelog_title = "Style", omit_from_changelog = true } +revert = { changelog_title = "Reverts", omit_from_changelog = true }