Skip to content

Commit

Permalink
Removes 'rules_and_presets' argument
Browse files Browse the repository at this point in the history
This commit removes the 'rules_and_presets' argument and changes the
'remark_args' default value.
  • Loading branch information
rickstaa committed Oct 18, 2021
1 parent 8c1bfd7 commit 4fde86e
Show file tree
Hide file tree
Showing 5 changed files with 344 additions and 26 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

### `remark_args`

**Optional**. Additional remark-lint input arguments. Defaults to `"--use=remark-preset-lint-recommended"`.
**Optional**. Additional remark-lint input arguments. Defaults to `"--use=remark-preset-lint-recommended"`. Default is applied programmatically when no input or config file is found.

### `annotate`

Expand Down Expand Up @@ -74,10 +74,6 @@ jobs:

**Optional**. Additional reviewdog flags. Defaults to `""`.

### `rules_and_presets`

**Optional**. Extra rules and presets that need to be installed. Defaults to `""`.

## Format your code

This action is meant to annotate any possible changes that would need to be made to make your code adhere to the [remark-lint linting guidelines](https://github.com/remarkjs/remark-lint). It does not apply these changes to your codebase. If you also want to apply the changes to your repository, you can use the [reviewdog/action-suggester](https://github.com/reviewdog/action-suggester). You can find examples of how this is done can be found in [rickstaa/action-remark-lint](https://github.com/rickstaa/action-remark-lint/)
8 changes: 3 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ inputs:
remark_args:
description: "Additional remark-lint input arguments."
required: false
default: "--use=remark-preset-lint-recommended"
# NOTE: The actual default values is '--use=remark-preset-lint-recommended' but it is
# only applied programmatically when no input or config file is found.
default: ""
# Reviewdog related inputs
github_token:
description: "GITHUB_TOKEN."
Expand Down Expand Up @@ -39,10 +41,6 @@ inputs:
description: "Additional reviewdog flags."
required: false
default: ""
rules_and_presets:
description: "Extra rules and presets that need to be installed"
required: false
default: ""
runs:
using: "docker"
image: "Dockerfile"
Expand Down
12 changes: 8 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ echo "[action-remark-lint] Versions: $(remark --version), remark-lint: $(npm rem
if [[ -f "package.json" ]]; then
echo "[action-remark-lint] Installing npm dependencies..."
npm install

# Remove action default value if package.json contains 'remarkConfig'
if grep -q '"remarkConfig"' package.json; then
INPUT_REMARK_ARGS=${INPUT_REMARK_ARGS:=--use=remark-preset-lint-recommended}
fi
fi

# Install additional plugins
if [[ -n "${INPUT_RULES_AND_PRESETS}" ]]; then
echo "[action-remark-lint] Installing npm dependencies..."
npm install ${INPUT_RULES_AND_PRESETS}
# Remove action default value if a remark config file is found
if [ -f .remarkc* ]; then
INPUT_REMARK_ARGS=${INPUT_REMARK_ARGS:=--use=remark-preset-lint-recommended}
fi

# NOTE: ${VAR,,} Is bash 4.0 syntax to make strings lowercase.
Expand Down
Loading

0 comments on commit 4fde86e

Please sign in to comment.