Skip to content

Commit

Permalink
feat(ci): add url locale checker
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 committed Sep 27, 2023
1 parent d9136e3 commit bcd1a79
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/markdown-lint-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
run: |
yarn markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md"
yarn prettier -w "**/${{ matrix.lang }}/**/*.md"
node ./scripts/check-url-locale.js --fix "files/${{ matrix.lang }}"
cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/front-matter-config.json "${{ github.workspace }}/files/${{ matrix.lang }}"
- name: Create PR with only fixable issues
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ jobs:
echo "Running Prettier"
yarn prettier -w ${files_to_lint}
echo "Running url locale checker"
node ./scripts/check-url-locale.js --fix ${files_to_lint}
if [[ -n $(git diff) ]]; then
echo "FILES_MODIFIED=true" >> $GITHUB_ENV
fi
Expand Down
6 changes: 5 additions & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"!*.md": "prettier --ignore-unknown --write",
"*.md": ["markdownlint-cli2 --fix", "prettier --write"]
"*.md": [
"markdownlint-cli2 --fix",
"prettier --write",
"node ./scripts/check-url-locale.js --fix"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"type": "module",
"scripts": {
"fix:json": "prettier -w \"**/*.json(c)?\"",
"fix:md": "markdownlint-cli2 --fix \"**/*.md\" && prettier -w \"**/*.md\"",
"fix:md": "markdownlint-cli2 --fix \"**/*.md\" && prettier -w \"**/*.md\" && node ./scripts/check-url-locale.js --fix files",
"fix:yml": "prettier -w \"**/*.yml\"",
"lint:json": "prettier -c \"**/*.json(c)?\"",
"lint:md": "markdownlint-cli2 \"**/*.md\" && prettier -c \"**/*.md\"",
"lint:md": "markdownlint-cli2 \"**/*.md\" && prettier -c \"**/*.md\" && node ./scripts/check-url-locale.js files",
"lint:yml": "prettier -c \"**/*.yml\"",
"prepare": "husky install"
},
Expand Down

0 comments on commit bcd1a79

Please sign in to comment.