From f1a1ffb2ba639828d51ded7adf186d29815cdfa1 Mon Sep 17 00:00:00 2001 From: Nick Osborn Date: Thu, 22 Sep 2022 21:37:30 +0800 Subject: [PATCH] Expose --dot option --- README.md | 30 +++++++++++++++--------------- action.yml | 3 +++ entrypoint.sh | 7 ++++--- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 988808a..29a5e30 100644 --- a/README.md +++ b/README.md @@ -10,25 +10,25 @@ A GitHub Action that performs style checking and linting for Markdown/CommonMark Basic usage with all options enabled: ```yaml - - - name: markdownlint-cli - uses: nosborn/github-action-markdown-cli@v3.0.1 - with: - files: . - config_file: .markdownlint.yaml - ignore_files: examples/ignore/* - ignore_path: examples/.markdownlintignore - rules: examples/rules/custom.js - +- name: markdownlint-cli + uses: nosborn/github-action-markdown-cli@v3.2.0 + with: + files: . + config_file: .markdownlint.yaml + dot: true + ignore_files: examples/ignore/* + ignore_path: examples/.markdownlintignore + rules: examples/rules/custom.js ``` ## Inputs -* `files` - what to process (files, directories, globs) -* `config_file` (optional) - configuration file (JSON or YAML) -* `ignore_files` (optional) - files to ignore/exclude (file, directory, glob) -* `ignore_path` (optional) - path to file with ignore pattern(s) -* `rules` (optional) - custom rule files (file, directory, glob, package) +- `files` - what to process (files, directories, globs) +- `config_file` (optional) - configuration file (JSON or YAML) +- `dot` (optional) - include files/folders with a dot (for example `.github`) +- `ignore_files` (optional) - files to ignore/exclude (file, directory, glob) +- `ignore_path` (optional) - path to file with ignore pattern(s) +- `rules` (optional) - custom rule files (file, directory, glob, package) ## License diff --git a/action.yml b/action.yml index 668b685..59f2bcc 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,9 @@ inputs: config_file: description: configuration file (JSON or YAML) required: false + dot: + description: include files/folders with a dot (for example `.github`) + required: false files: description: files, directories, or globs required: true diff --git a/entrypoint.sh b/entrypoint.sh index 8df3306..496d373 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,19 +2,20 @@ MARKDOWNLINT=markdownlint MARKDOWNLINT="${MARKDOWNLINT}${INPUT_CONFIG_FILE:+ -c ${INPUT_CONFIG_FILE}}" +MARKDOWNLINT="${MARKDOWNLINT}${INPUT_DOT:+ -d}" MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE_FILES:+ -i ${INPUT_IGNORE_FILES}}" MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE_PATH:+ -p ${INPUT_IGNORE_PATH}}" MARKDOWNLINT="${MARKDOWNLINT}${INPUT_RULES:+ -r ${INPUT_RULES}}" -PROBLEM_MATCHER="$(mktemp -p "${GITHUB_WORKSPACE}")" +PROBLEM_MATCHER="$(mktemp -p "${GITHUB_WORKSPACE:?}")" trap 'rm -f "${PROBLEM_MATCHER}"' EXIT cp /markdownlint-problem-matcher.json "${PROBLEM_MATCHER:?}" || exit echo "::add-matcher::${PROBLEM_MATCHER:?}" # shellcheck disable=SC2086 -${MARKDOWNLINT} ${INPUT_FILES} +${MARKDOWNLINT} ${INPUT_FILES:?} readonly RC=$? echo '::remove-matcher owner=markdownlint::' -exit ${RC} +exit "${RC}"