You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+45-11
Original file line number
Diff line number
Diff line change
@@ -76,12 +76,56 @@ setup(
76
76
install_requires=requirements,
77
77
packages=find_packages(),
78
78
)
79
+
```
80
+
81
+
### Adding pre-commit message lint
82
+
83
+
The semantic-release `pre-commit message lint` will validate your commit messages before the commit being accepted.
84
+
That will prevent you from having to rebase your commit history to adapt your commit messages to semantic-release standards.
85
+
86
+
Notes:
87
+
1. To activate commit message template in a pre-existing local repository, go to the project root folder and run `git init` command.
88
+
2. After `make commit-message-install`, Git will automatically activate commit message template to new cloned projects.
89
+
90
+
Run the following command:
91
+
92
+
```
93
+
make commit-message-install
94
+
```
95
+
96
+
If for some reason you need to skip commit lint, you can run git commit with the `--no-verify` tag as follows.
97
+
98
+
```
99
+
git commit -m "type: [typo], message: We do not recommend doing this!" --no-verify
100
+
```
101
+
102
+
We do not recommind using `--no-verify` for projects that use [commit lint ci step](#how-to-add-commit-lint-stage-to-gitlab) once it will validate all the branche commit messages.
103
+
104
+
If at least one commit message breaks semantic-release standards, you'll have to rebase and reword the wrong commit messages.
105
+
106
+
### How to use `rebase` to rename commit message?
107
+
108
+
If the [commit lint ci step](#how-to-add-commit-lint-stage-to-gitlab) fail, you can rebase you commit history and fix the wrong commit messages.
109
+
110
+
With your local repository up to date with your remote branch, run the following command.
111
+
Note: `N` is the number of commits you pushed to your branch.
112
+
113
+
```
114
+
git rebase -i HEAD~N
115
+
```
116
+
117
+
Edit the document and replace the first word `pick` to `r` or `reword`. Save it with `ctrl+o` and close it with `ctrl+x`;
118
+
119
+
Force push it with `-f` tag as follows:
120
+
121
+
```
122
+
git push -f origin my-branch-name
79
123
```
80
124
81
125
### How to add commit lint stage to Gitlab?
82
126
83
127
You must add a new stage to `gitlab-ci.yml` file adding two new arguments to semantic-release script.
84
-
- `commit-lint=true`to run commit-lint logic;
128
+
- `-commit-lint=true` to run commit-lint logic;
85
129
- `-branch-name=${CI_COMMIT_REF_NAME}` so that semantic-release can validate only the commits of the referenced branch.
86
130
87
131
```yaml
@@ -99,16 +143,6 @@ commit-lint:
99
143
- docker run registry.com/dataplatform/semantic-release:$SEMANTIC_RELEASE_VERSION up -commit-lint=true -branch-name=${CI_COMMIT_REF_NAME} -git-host ${CI_SERVER_HOST} -git-group ${CI_PROJECT_NAMESPACE} -git-project ${CI_PROJECT_NAME} -username ${PPD2_USERNAME} -password ${PPD2_ACCESS_TOKEN}
100
144
```
101
145
102
-
### Adding pre-commit message lint
103
-
104
-
Notes:
105
-
1. To activate commit message template in a pre-existing local repository, go to the project root folder and run `git init` command.
106
-
2. After `make commit-message-install`, Git will automatically activate commit message template to new cloned projects.
107
-
108
-
```
109
-
make commit-message-install
110
-
```
111
-
112
146
### If you need more information about the semantic release CLI usage you can run the following command.
0 commit comments