diff --git a/ci/links.sh b/ci/links.sh index 8a360ccce..ddbbad598 100755 --- a/ci/links.sh +++ b/ci/links.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash +set -e +shopt -s globstar + +FAILURE=0 + +git config --global --add safe.directory /usr/src/app npm install -g markdown-link-check git fetch origin main:main # To run this on the entire repo, replace the following command with `$(find ./ -type f | grep .md)` -for file_name in $(git diff --name-only $HEAD main); do - if [[ $file_name == *".md" ]]; then - npx markdown-link-check --config ./ci/link-config.json --progress --verbose "$file_name" - fi +for file_name in $(git diff --name-only $HEAD main -- ./**/*.md); do + npx markdown-link-check --config ./ci/link-config.json --progress --verbose "$file_name" || FAILURE=1 done + +exit $FAILURE diff --git a/ci/lint.sh b/ci/lint.sh index d3fe5da3b..00feec707 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash +set -e +shopt -s globstar + +FAILURE=0 + +git config --global --add safe.directory /usr/src/app npm install -g markdownlint-cli git fetch origin main:main # To run this on the entire repo, replace the following command with `$(find ./ -type f | grep .md)` -for file_name in $(git diff --name-only $HEAD main); do - if [[ $file_name == *".md" ]]; then - markdownlint -c ./ci/lint-config.json "$file_name" - fi +for file_name in $(git diff --name-only $HEAD main -- ./**/*.md); do + markdownlint -c ./ci/lint-config.json "$file_name" || FAILURE=1 done + +exit $FAILURE diff --git a/ci/setup.sh b/ci/setup.sh index 817d3eaaf..71534e05b 100755 --- a/ci/setup.sh +++ b/ci/setup.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +set -e + +git config --global --add safe.directory /usr/src/app git fetch origin main:main git diff --name-only main $HEAD > modified echo "these files have changed" diff --git a/ci/spelling.sh b/ci/spelling.sh index a455074a3..1a447a1af 100755 --- a/ci/spelling.sh +++ b/ci/spelling.sh @@ -1,7 +1,13 @@ #!/usr/bin/env bash +set -eo pipefail +shopt -s globstar + function spellcheck () { - git diff --name-only --diff-filter=AM main $HEAD | grep '\.md$' | xargs --no-run-if-empty -L1 npx cspell --show-suggestions -c ./ci/spelling-config.json + FAILURE=0 + git diff --name-only --diff-filter=AM main $HEAD -- ./**/*.md | \ + xargs --no-run-if-empty -L1 npx cspell --show-suggestions -c ./ci/spelling-config.json || FAILURE=1 + return $FAILURE } function printhelp () { @@ -21,6 +27,7 @@ function printhelp () { } +git config --global --add safe.directory /usr/src/app npm install -g cspell git fetch origin main:main # Print help if spellcheck fails