Skip to content

Commit 3f91066

Browse files
authored
Merge pull request #218 from commitizen-tools/fix-pre-commit-config-doc
docs(README): add "pre-commit install --hook-type commit-msg" command
2 parents 085294b + a37ed5c commit 3f91066

10 files changed

+20
-22
lines changed

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Please put an `x` in the box that applies
1515

1616
## Checklist:
1717
- [ ] Add test cases to all the changes you introduce
18-
- [ ] Run `./script/reformat` and `./script/test` locally to ensure this change passes linter check and test
18+
- [ ] Run `./script/format` and `./script/test` locally to ensure this change passes linter check and test
1919
- [ ] Test the changes on the local machine manually
2020
- [ ] Update the documentation for the changes
2121

.github/workflows/bumpversion.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- master
77

88
jobs:
9-
build:
9+
bump-version:
1010
if: "!startsWith(github.event.head_commit.message, 'bump:')"
1111
runs-on: ubuntu-latest
1212
strategy:
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
python --version
27-
python -m pip install -U poetry
27+
python -m pip install -U pip poetry
2828
- name: Configure repo
2929
run: |
3030
git config --local user.email "action@github.com"

.github/workflows/docspublish.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- master
77

88
jobs:
9-
deploy:
9+
publish-documentation:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2

.github/workflows/pythonpackage.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Python package
33
on: [pull_request]
44

55
jobs:
6-
build:
7-
6+
python-check:
87
runs-on: ubuntu-latest
98
strategy:
109
max-parallel: 4
@@ -21,22 +20,14 @@ jobs:
2120
python-version: ${{ matrix.python-version }}
2221
- name: Install dependencies
2322
run: |
24-
python -m pip install --pre -U poetry
23+
python -m pip install -U pip poetry
2524
poetry --version
2625
poetry install
27-
- name: Run tests
26+
- name: Run tests and linters
2827
run: |
2928
git config --global user.email "action@github.com"
3029
git config --global user.name "GitHub Action"
3130
./scripts/test
32-
- name: Check commit
33-
run: |
34-
poetry run python -m commitizen check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} || \
35-
if [ $$? == 3 ] ; then
36-
exit 0;
37-
else
38-
exit 1;
39-
fi
4031
- name: Upload coverage to Codecov
4132
if: runner.os == 'Linux'
4233
uses: codecov/codecov-action@v1.0.3

.github/workflows/pythonpublish.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
python-version: '3.x'
2020
- name: Install dependencies
2121
run: |
22-
python -m pip install --pre -U poetry mkdocs mkdocs-material
22+
python -m pip install -U pip poetry mkdocs mkdocs-material
2323
poetry --version
2424
poetry install
2525
- name: Publish

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ repos:
1818

1919
- repo: local
2020
hooks:
21-
- id: reformat
22-
name: reformat
21+
- id: format
22+
name: format
2323
language: system
2424
pass_filenames: false
25-
entry: ./scripts/reformat
25+
entry: ./scripts/format
2626
types: [python]
2727

2828
- id: linter and test

docs/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ repos:
8888
stages: [commit-msg]
8989
```
9090
91+
After the configuration is added, you'll need to run
92+
93+
```sh
94+
pre-commit install --hook-type commit-msg
95+
```
96+
9197
Read more about the `check` command [here](https://commitizen-tools.github.io/commitizen/check/).
9298

9399
### Help

docs/contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ If you're a first-time contributor, you can check the issues with [good first is
1616
6. Add test cases for all your changes.
1717
(We use [CodeCov](https://codecov.io/) to ensure our test coverage does not drop.)
1818
7. Use [commitizen](https://github.com/commitizen-tools/commitizen) to do git commit.
19-
8. Run `./scripts/reformat` and `./scripts/test` to ensure you follow the coding style and the tests pass.
19+
8. Run `./scripts/format` and `./scripts/test` to ensure you follow the coding style and the tests pass.
2020
9. Update `READMD.md` and `CHANGELOG.md` for your changes.
2121
10. Send a [pull request](https://github.com/commitizen-tools/commitizen/pulls) 🙏

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ classifiers = [
4444
]
4545

4646
[tool.poetry.dependencies]
47-
python = "^3.6"
47+
python = "^3.6.1"
4848
questionary = "^1.4.0"
4949
decli = "^0.5.0"
5050
colorama = "^0.4.1"
@@ -67,6 +67,7 @@ mkdocs-material = "^4.1"
6767
isort = "^4.3.21"
6868
freezegun = "^0.3.15"
6969
pydocstyle = "^5.0.2"
70+
pre-commit = "^2.6.0"
7071

7172
[tool.poetry.scripts]
7273
cz = "commitizen.cli:main"
File renamed without changes.

0 commit comments

Comments
 (0)