From b9c3f2011ab4f49d4841184a893c3131945767ae Mon Sep 17 00:00:00 2001 From: Tad Johnston Date: Thu, 7 May 2020 11:36:16 -0700 Subject: [PATCH] adding inputs * added `--ignore-pattern` as per styleling option * added `name` input to allow for multiple stylelints to be ran --- action.yml | 5 +++++ entrypoint.sh | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index c139905..5833043 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,9 @@ inputs: level: description: 'Report level for reviewdog [info,warning,error]' default: 'error' + name: + description: 'Report name' + default: 'stylelint' reporter: description: | Reporter of reviewdog command [github-pr-check,github-pr-review,github-check]. @@ -19,6 +22,8 @@ inputs: default: '**/*.css' stylelint_config: description: "It's same as `--config` flag of stylelint." + stylelint_ignore: + description: "Files or glob. It's the same as `--ignore-pattern` of stylelint" runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 45adc41..0b4f902 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,10 +12,10 @@ $(npm bin)/stylelint --version if [ "${INPUT_REPORTER}" == 'github-pr-review' ]; then # Use jq and github-pr-review reporter to format result to include link to rule page. - $(npm bin)/stylelint "${INPUT_STYLELINT_INPUT:-'**/*.css'}" --config="${INPUT_STYLELINT_CONFIG}" -f json \ + $(npm bin)/stylelint "${INPUT_STYLELINT_INPUT:-'**/*.css'}" --config="${INPUT_STYLELINT_CONFIG}" --ignore-pattern="${INPUT_STYLELINT_IGNORE}" -f json \ | jq -r '.[] | {source: .source, warnings:.warnings[]} | "\(.source):\(.warnings.line):\(.warnings.column):\(.warnings.severity): \(.warnings.text) [\(.warnings.rule)](https://stylelint.io/user-guide/rules/\(.warnings.rule))"' \ - | reviewdog -efm="%f:%l:%c:%t%*[^:]: %m" -name="stylelint" -reporter=github-pr-review -level="${INPUT_LEVEL}" + | reviewdog -efm="%f:%l:%c:%t%*[^:]: %m" -name="${INPUT_NAME:-stylelint}" -reporter=github-pr-review -level="${INPUT_LEVEL}" else - $(npm bin)/stylelint "${INPUT_STYLELINT_INPUT:-'**/*.css'}" --config="${INPUT_STYLELINT_CONFIG}" \ - | reviewdog -f="stylelint" -reporter="${INPUT_REPORTER:-github-pr-check}" -level="${INPUT_LEVEL}" + $(npm bin)/stylelint "${INPUT_STYLELINT_INPUT:-'**/*.css'}" --config="${INPUT_STYLELINT_CONFIG}" --ignore-pattern="${INPUT_STYLELINT_IGNORE}" \ + | reviewdog -f="stylelint" -name="${INPUT_NAME:-stylelint}" -reporter="${INPUT_REPORTER:-github-pr-check}" -level="${INPUT_LEVEL}" fi