Skip to content

Commit a36cc29

Browse files
committed
feat: add has-message script, close #40
1 parent da4aa47 commit a36cc29

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ script:
1010
# check syntax of the script
1111
- node --check bin/commit-message-install.js
1212
- node --check bin/commit-message-run.js
13+
- node --check bin/has-commit-message.js
1314
- node --check .
1415
- npm test
1516
- DEBUG=commit-message-install node ./bin/commit-message-install.js
1617
- DEBUG=commit-message-install node ./bin/commit-message-install.js --else "echo --else is working"
1718
# synthetic test case
1819
- DEBUG=commit-message-install node ./bin/commit-message-install.js -f test/message.txt
1920
- npm run demo
21+
# demo test has-commit-message
22+
- ./bin/has-commit-message.js -f test/message.txt
23+
2024
after_success:
2125
- npm run semantic-release
2226
branches:

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ $(npm bin)/set-status --label "context label" --state success --description "sho
119119

120120
State can be "error", "pending", "failure" or "success". `--label` is optional, if not set, then the platform and the package name will be used.
121121

122+
### Has commit message
123+
124+
You can use script `has-message` to check if the last or a specific commit has JSON commit information block
125+
126+
```text
127+
$(npm bin)/has-message
128+
$(npm bin)/has-message --sha f81a00
129+
```
130+
131+
If there is a message in the commit's body the script will exit with code 0. Otherwise it will exit with code 1.
132+
133+
See [commit-message-install-example](https://github.com/bahmutov/commit-message-install-example) repo for an example.
134+
122135
## API
123136

124137
### getJsonFromGit

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"commit-message-install": "bin/commit-message-install.js",
99
"cmi": "bin/commit-message-install.js",
1010
"run-if": "bin/commit-message-run.js",
11-
"set-status": "bin/set-commit-status.js"
11+
"set-status": "bin/set-commit-status.js",
12+
"has-message": "bin/has-commit-message.js"
1213
},
1314
"config": {
1415
"pre-git": {

0 commit comments

Comments
 (0)