Skip to content

Commit

Permalink
Allow -f fix for lint_markdown.sh (#1147)
Browse files Browse the repository at this point in the history
This change allows for 2 arguments to be specified, and forward them to
the `markdownlint-cli`. This allows us to use the `-f` flag to autofix
markdown issues.

Modifying contribution from @scottamain, if there is any reason to avoid
this flag let me know!
  • Loading branch information
GleasonK authored Feb 10, 2023
1 parent 636c72b commit d057878
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build_tools/github_actions/lint_markdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
# If passing the files as a glob, be sure to wrap in quotes. For more info,
# see https://github.com/igorshubovych/markdownlint-cli#globbing

if [[ $# -ne 1 ]] ; then
echo "Usage: $0 <files|directories|globs>"
if [[ $# -gt 2 ]] ; then
echo "Usage: $0 [-f] <files|directories|globs>"
echo " -f Autofix markdown issues."
echo " "
echo "All file/directory/glob paths must be relative to the repo root."
echo "Glob patterns must be wrapped in quotes."
Expand All @@ -31,7 +32,6 @@ readonly STABLEHLO_ROOT_DIR="${SCRIPT_DIR}/../.."
# These must be relative to the repo root because that's the context
# in which the Docker container will mount and find all files
readonly CONFIG=".markdownlint.yaml"
readonly FILES="$1"

# Verify Docker is available
if ! command -v docker &> /dev/null
Expand All @@ -43,4 +43,4 @@ fi
# Run markdownlint-cli in Docker to avoid node versioning issues
docker run -v $STABLEHLO_ROOT_DIR:/workdir \
ghcr.io/igorshubovych/markdownlint-cli:v0.32.2 \
--config $CONFIG "$FILES"
--config $CONFIG "$@"

0 comments on commit d057878

Please sign in to comment.