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

Introduce github workflows for cspell and textlint #2971

Merged
merged 26 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 22 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
16 changes: 16 additions & 0 deletions .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check spelling

on:
pull_request:

jobs:
main:
name: Check spelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: streetsidesoftware/cspell-action@v2
with:
files: |
content/**/*
config: .vscode/cspell.json
17 changes: 17 additions & 0 deletions .github/workflows/check-text.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Check text linter rules
# cSpell:ignore startswith

on:
pull_request:

jobs:
main:
name: Check text linter rules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Make sure that we only install the dependencies for textlint to speed up install
- run: |
jq 'del(.dependencies) | .scripts |= with_entries(select(.key | contains("check:"))) | .devDependencies |= with_entries( select(.key | startswith("textlint")))' package.json > package2.json && mv package2.json package.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions:

  • Why prune the scripts?
  • Simplify
    package.json > package2.json && mv package2.json package.json
    to just
    package.json > package.json?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • if I don't prune the scripts it runs all of the npm install dependencies which loads submodules, etc., which is a big hit on performance
  • because if I do jq package.json > package.json the input file is overwritten and I get an empty file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • For scripts, all you should need is to removed prepare -- I don't know if that can help simplify the jq arguments.
  • Ok (re file override)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually, without modifying scripts, you can avoid prepare being run by adding the --ignore-scripts flag to the two npm commands below.

- run: npm install
- run: npm run check:text
2 changes: 1 addition & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ignorePaths": ["*.svg"],
// words here are only listed for their spelling, if there is a certain way
// to write a word (e.g. OpenTelemetry vs Opentelemetry or cloud native vs
// cloud-native), edit the text-lint rules in package.json
// cloud-native), edit the text-lint rules in .textlintrc.json
"words": [
"APAC",
"Alolita",
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links",
"_check:links:internal": "npm run __check:links",
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
"_check:spelling": "npx cspell -c .vscode/cspell.json content data",
"_check:text": "npx textlint content data",
"_check:spelling": "npx cspell --no-progress -c .vscode/cspell.json content",
"_check:text": "npx textlint content",
"_get:no": "echo SKIPPING get operation",
"_get:submodule:non-lang": "npm run _get:submodule -- content-modules/opentelemetry-specification themes/docsy",
"_get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}",
Expand All @@ -32,6 +32,8 @@
"check:format": "npm run _check:format || (echo '[help] Run: npm run format'; exit 1)",
"check:links": "npm run _check:links",
"check:links:internal": "npm run _check:links:internal",
"check:spelling": "npm run _check:spelling",
"check:text": "npm run _check:text",
"clean": "make clean",
"cp:spec": "./scripts/content-modules/cp-pages.sh",
"diff:check": "git diff --name-only --exit-code || (echo; echo 'WARNING: the files above have not been committed'; echo)",
Expand Down