Skip to content

Commit

Permalink
Merge pull request #48 from tsuyoshicho/fix/package-re-depend
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuyoshicho authored May 12, 2020
2 parents ad6b4e9 + e61369f commit d78a4ed
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ RUN apk --update add git && \
rm -rf /var/lib/apt/lists/* && \
rm /var/cache/apk/*

WORKDIR /
ENV PATH $PATH:/node_modules/.bin
COPY package.json package-lock.json /
RUN npm ci --production

COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ github-pr-review can use Markdown and add a link to rule page in reviewdog repor

textlint arguments (i.e. target dir:`doc/*`)

### `textlint_version`

if textlint do not contain in project, use this version.

## Customizes

`.textlintrc` put in your repo.
And package.json that install textlint with plugins, in your repo.

## Example usage

Expand Down
9 changes: 4 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ inputs:
description: "flags and args of textlint command. Default: '.'"
default: '.'
required: false
textlint_version:
description: "if textlint do not contain in project, use this version. default:'11.6.3'"
default: '11.6.3'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.github_token }}
- ${{ inputs.level }}
- ${{ inputs.reporter }}
- ${{ inputs.textlint_flags }}
branding:
icon: 'alert-octagon'
color: 'blue'
23 changes: 18 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ cd "$GITHUB_WORKSPACE"

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

textlint --version
# nothing command, try project package install
if [ ! -f "$(npm bin)/textlint" ]; then
npm install
fi
# nothing command in after install, use command direct install
PACKAGE=""
if [ ! -f "$(npm bin)/textlint" ]; then
PACKAGE="-p textlint@${INPUT_TEXTLINT_VERSION:-11.6.3}"
echo textlint direct install version: ${INPUT_TEXTLINT_VERSION:-11.6.3}
else
npx textlint --version
fi

textlint -f checkstyle "${INPUT_TEXTLINT_FLAGS:-'.'}" \
| reviewdog -f=checkstyle -name="textlint" \
-reporter="${INPUT_REPORTER:-'github-pr-check'}" \
-level="${INPUT_LEVEL:-'error'}"
npx ${PACKAGE} textlint -f checkstyle "${INPUT_TEXTLINT_FLAGS:-.}" \
| reviewdog -f=checkstyle -name="textlint" \
-reporter="${INPUT_REPORTER:-'github-pr-check'}" \
-level="${INPUT_LEVEL:-'error'}"

# EOF

0 comments on commit d78a4ed

Please sign in to comment.