-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: commit message linter for changelog\n
Enforce conventional commit style messages needed for automatic changelogs
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# lint-commits.sh | ||
#!/bin/bash | ||
set -e | ||
set -u | ||
|
||
if [[ $TRAVIS_PULL_REQUEST_SLUG != "" && $TRAVIS_PULL_REQUEST_SLUG != $TRAVIS_REPO_SLUG ]]; then | ||
# This is a Pull Request from a different slug, hence a forked repository | ||
git remote add "$TRAVIS_PULL_REQUEST_SLUG" "https://github.com/$TRAVIS_PULL_REQUEST_SLUG.git" | ||
git fetch "$TRAVIS_PULL_REQUEST_SLUG" | ||
|
||
# Use the fetched remote pointing to the source clone for comparison | ||
TO="$TRAVIS_PULL_REQUEST_SLUG/$TRAVIS_PULL_REQUEST_BRANCH" | ||
else | ||
# This is a Pull Request from the same remote, no clone repository | ||
TO=$TRAVIS_COMMIT | ||
fi | ||
|
||
# Lint all commits in the PR | ||
# - Covers fork pull requests (when TO=slug/branch) | ||
# - Covers branch pull requests (when TO=branch) | ||
./node_modules/.bin/commitlint --from="$TRAVIS_BRANCH" --to="$TO" | ||
|
||
# Always lint the triggerig commit | ||
# - Covers direct commits | ||
./node_modules/.bin/commitlint --from="$TRAVIS_COMMIT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
extends: [ | ||
'@commitlint/config-angular', | ||
'@commitlint/config-lerna-scopes' | ||
], | ||
rules: { | ||
'header-max-length': [2, 'always', 100], | ||
'footer-max-length': [2, 'always', 100], | ||
'body-tense': [2, 'always', ['present-imperative']], | ||
'footer-tense': [2, 'always', ['present-imperative']], | ||
'subject-tense': [2, 'always', ['present-imperative']], | ||
'lang': [0, 'always', 'eng'], | ||
'body-leading-blank': [2, 'always'], | ||
'footer-leading-blank': [2, 'always'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters