Skip to content

Commit

Permalink
Merge branch 'master' into markdownlint
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-boulle authored Sep 21, 2020
2 parents f915f25 + 9605e51 commit 9f06901
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,19 @@ you can add this to your configuration so commit messages are checked locally:
Into `.pre-commit-config.yaml`:

```yaml
---
default_stages: [commit]
repos:
---
- repo: https://github.com/lumapps/commit-message-validator
rev: master
hooks:
- id: commit-message-validator
stages: [commit-msg]
args: [--allow-temp]
- repo: https://github.com/lumapps/commit-message-validator
rev: master
hooks:
- id: commit-message-validator
stages: [commit-msg]
args: [--allow-temp]
```

`default_stages` tells which stage to install hooks that do not specify
a `stages` option.

Then run `pre-commit install --hook-type commit-msg` to install the
`commit-message-validator`

Expand Down
5 changes: 3 additions & 2 deletions check_message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ then
exit
fi

MESSAGE=$(<"$1")
# removing comment lines from message
MESSAGE=$(sed '/^#/d' "$1")

FIRST_WORD=${MESSAGE%% *}
if [[ "${FIRST_WORD,,}" == merge ]]
Expand All @@ -44,6 +45,6 @@ fi
# print message so you don't lose it in case of errors
# (in case you are not using `-m` option)
echo "Options: JIRA=$COMMIT_VALIDATOR_NO_JIRA, TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP"
printf "checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" "$(grep -v "#" <<< "$MESSAGE")"
printf "checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" "$MESSAGE"

validate "$MESSAGE"

0 comments on commit 9f06901

Please sign in to comment.