File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ language: node_js
3
3
node_js : " stable"
4
4
after_success :
5
5
- npm run travis:coverage
6
+ after_failure :
7
+ - sh .travis/review-textlint.sh
6
8
cache :
7
9
directories :
8
10
- node_modules
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ if [ " $CI_PULL_REQUEST " == false ] || [ -z " $CI_PULL_REQUEST " ]; then
3
+ echo ' not pull request.'
4
+ exit 0
5
+ fi
6
+
7
+ gem install --no-document checkstyle_filter-git saddler saddler-reporter-github
8
+
9
+ # Diff Target Branch
10
+ # diff HEAD...target
11
+ # http://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-git-branch
12
+ # http://qiita.com/upinetree/items/0b74b08b64442f0a89b9
13
+ diffBranchName=$( git show-branch | grep ' *' | grep -v " $( git rev-parse --abbrev-ref HEAD) " | head -1 | awk -F' []~^[]' ' {print $2}' )
14
+ # 変更行のみを対象にする
15
+ git diff --name-only --diff-filter=ACMR ${diffBranchName} \
16
+ | grep -a ' *.md$' \
17
+ | xargs $( npm bin) /textlint -f checkstyle \
18
+ | checkstyle_filter-git diff ${diffBranchName} \
19
+ | saddler report \
20
+ --require saddler/reporter/github \
21
+ --reporter Saddler::Reporter::Github::PullRequestReviewComment
You can’t perform that action at this time.
0 commit comments