Files
setup-task/Taskfile.yml
per1234 f08b86a4a9 Add CI workflow to check Markdown files for problems
On every push and pull request that affects relevant files, and periodically, check the repository's Markdown files for
problems:

- Use markdownlint to check for common problems and formatting.
- Use markdown-link-check to check for broken links.

Arduino's Markdown style is defined by the `.markdownlint.yml` file.

In the event the repository contains externally maintained Markdown files, markdownlint can be configured to ignore them
via a `.markdownlintignore` file:
https://github.com/igorshubovych/markdownlint-cli#ignoring-files

markdown-link-check is configured via the `.markdown-link-check.json` file:
https://github.com/tcort/markdown-link-check#config-file-format
2021-05-07 02:38:53 -07:00

92 lines
2.2 KiB
YAML

version: "3"
tasks:
build:
desc: Build the project
deps:
- task: ts:build
check:
desc: Check for problems with the project
deps:
- task: ts:test
- task: action:validate
- task: markdown:lint
- task: general:check-spelling
ts:install-deps:
desc: Install TypeScript development dependencies
cmds:
- npm install
ts:build:
desc: Build the action's TypeScript code.
deps:
- task: ts:install-deps
cmds:
- npx tsc
- npx ncc build
ts:test:
desc: Test the action's TypeScript code.
deps:
- task: ts:install-deps
cmds:
- npx jest
ts:lint:
desc: Lint TypeScript code
deps:
- task: ts:install-deps
cmds:
- npx eslint --ext .js,.jsx,.ts,.tsx .
ts:fix-lint:
desc: Fix TypeScript code linting violations
deps:
- task: ts:install-deps
cmds:
- npx eslint --ext .js,.jsx,.ts,.tsx --fix .
action:validate:
desc: Validate GitHub Actions metadata against JSON schema
vars:
ACTION_METADATA_SCHEMA_PATH:
sh: mktemp -t github-action-schema-XXXXXXXXXX.json
cmds:
- wget --quiet --output-document="{{.ACTION_METADATA_SCHEMA_PATH}}" https://json.schemastore.org/github-action
- npx ajv-cli validate --strict=false -s "{{.ACTION_METADATA_SCHEMA_PATH}}" -d "action.yml"
markdown:lint:
desc: Check for problems in Markdown files
cmds:
- npx markdownlint-cli "**/*.md"
markdown:check-links:
desc: Check for broken links
cmds:
- |
# NOTE: npx --call uses the native shell, so this task can't be used on Windows.
npx --package=markdown-link-check --call='
STATUS=0
for file in $(find -name "*.md"); do
markdown-link-check \
--quiet \
--config "./.markdown-link-check.json" \
"$file"
STATUS=$(( $STATUS + $? ))
done
exit $STATUS'
general:check-spelling:
desc: Check for commonly misspelled words
cmds:
- poetry install --no-root
- poetry run codespell
general:correct-spelling:
desc: Correct commonly misspelled words where possible
cmds:
- poetry install --no-root
- poetry run codespell --write-changes