Last active
September 8, 2017 10:44
-
-
Save taichi/fef9839243c2fbd017d272c7d838dbde to your computer and use it in GitHub Desktop.
CircleCIでtextlintを使ってチェックした結果をreviewdogで自動的にコメントする。環境変数に、CACHE_KEYとREVIEWDOG_GITHUB_API_TOKENが必要。see. http://qiita.com/azu/items/c563da0b5455a1b1dca2
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
version: 2 | |
jobs: | |
build: | |
working_directory: ~/project | |
docker: | |
- image: circleci/node:8 | |
steps: | |
- checkout | |
- restore_cache: | |
key: dependency-{{ .Environment.CACHE_KEY }}-{{ checksum "yarn.lock" }} | |
- run: yarn install | |
- run: | |
name: run textlint if markdown changed | |
environment: | |
REVIEWDOG_VERSION: "0.9.8" | |
command: | | |
cond="git diff --name-only --diff-filter=ACMR origin/master | grep -a '.*.md$'" | |
if eval $cond >/dev/null; then | |
if ! eval $cond | xargs $(npm bin)/textlint -f pretty-error; then | |
mkdir -p ~/bin/ && export PATH="~/bin/:$PATH" | |
curl -fSL https://github.com/haya14busa/reviewdog/releases/download/$REVIEWDOG_VERSION/reviewdog_linux_amd64 -o ~/bin/reviewdog && chmod +x ~/bin/reviewdog | |
git diff --name-only --diff-filter=ACMR origin/master | grep -a '.*.md$' \ | |
| xargs $(npm bin)/textlint -f checkstyle \ | |
| reviewdog -f=checkstyle -name="textlint" -ci="circle-ci" | |
fi | |
fi | |
- save_cache: | |
key: dependency-{{ .Environment.CACHE_KEY }}-{{ checksum "yarn.lock" }} | |
paths: | |
- ~/.cache/yarn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment