Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix ci linter scripts #1223

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions ci/links.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 10 additions & 4 deletions ci/lint.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions ci/setup.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
9 changes: 8 additions & 1 deletion ci/spelling.sh
Original file line number Diff line number Diff line change
@@ -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
tuminoid marked this conversation as resolved.
Show resolved Hide resolved
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 () {
Expand All @@ -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
Expand Down
Loading