@@ -16,6 +16,15 @@ inputs:
1616 description : configuration file (JSON or YAML)
1717 required : false
1818 deprecationMessage : Please use 'config' instead.
19+ disable :
20+ description : enable certain rules, for example 'MD013 MD041'
21+ required : false
22+ dot :
23+ description : if 'true', include files/folders with a dot (for example '.github')
24+ required : false
25+ enable :
26+ description : enable certain rules, for example 'MD013 MD041'
27+ required : false
1928 files :
2029 description : files, directories, or globs
2130 required : true
@@ -25,14 +34,14 @@ inputs:
2534 ignore-path :
2635 description : path to file with ignore pattern(s)
2736 required : false
28- deprecationMessage : Please use 'ignore-path' instead.
2937 ignore_files :
3038 description : files to ignore/exclude
3139 required : false
3240 deprecationMessage : Please use 'ignore' instead.
3341 ignore_path :
3442 description : path to file with ignore pattern(s)
3543 required : false
44+ deprecationMessage : Please use 'ignore-path' instead.
3645 rules :
3746 description : custom rule files
3847 required : false
@@ -43,17 +52,36 @@ runs:
4352 - run : |
4453 echo '::group::Installing markdownlint-cli'
4554 version="$(npm view --json markdownlint-cli@${INPUT_CLI_VERSION:?} | jq -r .version)"
55+ major_version="$(cut -d . -f 1 <<<"${version}")"
56+ minor_version="$(cut -d . -f 2 <<<"${version}")"
4657 prefix="${RUNNER_TOOL_CACHE:-${RUNNER_TEMP:?}}/markdownlint-cli/${version}"
4758 mkdir -p "${prefix}"
4859 # FIXME: --global and --production are deprecated
4960 NPM_CONFIG_PREFIX="${prefix}" npm install --global --production "markdownlint-cli@${version}"
5061 echo '::endgroup::'
5162
5263 markdownlint="${prefix}/bin/markdownlint"
53- markdownlint="${markdownlint}${INPUT_CONFIG_FILE:+ -c ${INPUT_CONFIG_FILE:?}}"
54- markdownlint="${markdownlint}${INPUT_IGNORE:+ -i ${INPUT_IGNORE:?}}"
55- markdownlint="${markdownlint}${INPUT_IGNORE_PATH:+ -p ${INPUT_IGNORE_PATH:?}}"
56- markdownlint="${markdownlint}${INPUT_RULES:+ -r ${INPUT_RULES:?}}"
64+ markdownlint+="${INPUT_CONFIG_FILE:+ -c ${INPUT_CONFIG_FILE:?}}"
65+ if [[ ${major_version} -gt 0 ]] || [[ ${minor_version} -ge 30 ]]; then
66+ markdownlint+="${INPUT_DISABLE:+ --disable ${INPUT_DISABLE:?}}"
67+ fi
68+ if [[ ${major_version} -gt 0 ]] || [[ ${minor_version} -ge 27 ]]; then
69+ if [[ "$(tr '[:upper:]' '[:lower:]' <<<"${INPUT_DOT}")" == true ]]; then
70+ markdownlint+=' --dot'
71+ fi
72+ fi
73+ if [[ ${major_version} -gt 0 ]] || [[ ${minor_version} -ge 30 ]]; then
74+ markdownlint+="${INPUT_ENABLE:+ --enable ${INPUT_ENABLE:?}}"
75+ fi
76+ if [[ ${major_version} -gt 0 ]] || [[ ${minor_version} -ge 7 ]]; then
77+ markdownlint+="${INPUT_IGNORE:+ -i ${INPUT_IGNORE:?}}"
78+ fi
79+ if [[ ${major_version} -gt 0 ]] || [[ ${minor_version} -ge 22 ]]; then
80+ markdownlint+="${INPUT_IGNORE_PATH:+ -p ${INPUT_IGNORE_PATH:?}}"
81+ fi
82+ if [[ ${major_version} -gt 0 ]] || [[ ${minor_version} -ge 11 ]]; then
83+ markdownlint+="${INPUT_RULES:+ -r ${INPUT_RULES:?}}"
84+ fi
5785
5886 echo "::add-matcher::${GITHUB_ACTION_PATH:?}/markdownlint-problem-matcher.json"
5987 # shellcheck disable=SC2086
6593 env:
6694 INPUT_CLI_VERSION: ${{ inputs.cli-version }}
6795 INPUT_CONFIG_FILE: ${{ inputs.config || inputs.config_file }}
96+ INPUT_DISABLE: ${{ inputs.disable }}
97+ INPUT_DOT: ${{ inputs.dot }}
98+ INPUT_ENABLE: ${{ inputs.enable }}
6899 INPUT_FILES: ${{ inputs.files }}
69100 INPUT_IGNORE: ${{ inputs.ignore || inputs.ignore_files }}
70101 INPUT_IGNORE_PATH: ${{ inputs.ignore-path || inputs.ignore_path }}
0 commit comments