Skip to content

Instantly share code, notes, and snippets.

@taichi
Last active September 8, 2017 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taichi/fef9839243c2fbd017d272c7d838dbde to your computer and use it in GitHub Desktop.
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
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