Skip to content

Commit

Permalink
Merge pull request #2767 from chrahunt/fix-travis-checks
Browse files Browse the repository at this point in the history
Fix Travis commit message checks
  • Loading branch information
dignifiedquire committed Jul 19, 2017
2 parents 545dc05 + 8c98439 commit 69978ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -35,7 +35,7 @@ before_script:
- sh -e /etc/init.d/xvfb start
- npm run init
- export $(openssl aes-256-cbc -pass env:CREDENTIALS_PASS -d -in credentials)
- 'if [ "$VALIDATE_COMMIT_MSG" == "true" ]; then npm run travis; else ./scripts/validate-commit-msg.sh $TRAVIS_COMMIT; fi'
- 'if [ "$VALIDATE_COMMIT_MSG" == "true" ]; then ./scripts/validate-commit-msg.sh $TRAVIS_COMMIT; fi'
- 'if [ "$LINT" == "true" ]; then npm run lint; fi'

script:
Expand Down
10 changes: 8 additions & 2 deletions scripts/validate-commit-msg.sh
Expand Up @@ -19,14 +19,20 @@ if [ -z "$COMMIT_REV" ]; then
exit 1
fi


# Resolve our file for output
# DEV: We use `.git` to avoid cluttering the working directory
GIT_DIR="$(git rev-parse --git-dir)"
TARGET_FILE="$GIT_DIR/VALIDATE_COMMIT_MSG"
TARGET_FILENAME=VALIDATE_COMMIT_MSG
TARGET_FILE="$GIT_DIR/$TARGET_FILENAME"

echo "Retrieving relevant commit message for $COMMIT_REV"
# Output our log message to a file
# DEV: We use `--no-merges` to skip merge commits introduced by GitHub
git log --no-merges --format=format:"%s" -n 1 "$COMMIT_REV" > "$TARGET_FILE"

echo "Validating contents of $TARGET_FILE"
cat "$TARGET_FILE"

# Validate our message
./node_modules/.bin/validate-commit-msg "$TARGET_FILE"
./node_modules/.bin/validate-commit-msg "$TARGET_FILENAME"

0 comments on commit 69978ee

Please sign in to comment.