Skip to content

Commit

Permalink
Merge pull request #1 from datalad/cz
Browse files Browse the repository at this point in the history
chore: add conventional commit setup
  • Loading branch information
mih authored Sep 20, 2024
2 parents ef6e7bc + 1d0ce8c commit cd1386d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Conventional commits

on: pull_request

jobs:
check-messages:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: x64
- name: Checkout
uses: actions/checkout@v4
with:
# we need all the history to be able to resolve revision ranges properly
fetch-depth: 0
- name: Install commitizen
run: python -m pip install commitizen
- name: Run commit message checks
run: |
cz check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ clean = [
"make -C docs clean",
]

[tool.hatch.envs.cz]
extra-dependencies = [
"commitizen",
]
[tool.hatch.envs.cz.scripts]
check = [
# check all commit messages since the (before) beginning
"cz check --rev-range 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEAD",
]

[tool.coverage.run]
source_pkgs = ["datalad_core", "tests"]
Expand All @@ -92,3 +101,13 @@ exclude_lines = [
"raise NotImplementedError",
]


[tool.commitizen]
name = "cz_customize"

[tool.commitizen.customize]
commit_parser = "^((?P<change_type>feat|fix|rf|perf|test|doc|BREAKING CHANGE)(?:\\((?P<scope>[^()\r\n]*)\\)|\\()?(?P<breaking>!)?|\\w+!):\\s(?P<message>.*)?(?P<body>.*)?"
change_type_order = ["BREAKING CHANGE", "feat", "fix", "rf", "perf", "doc", "test"]
schema_pattern = "(?s)(ci|doc|feat|fix|perf|rf|style|test|chore|revert|bump)(\\(\\S+\\))?!?:( [^\\n\\r]+)((\\n\\n.*)|(\\s*))?$"


0 comments on commit cd1386d

Please sign in to comment.