-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into translation/web-css-syntax
- Loading branch information
Showing
402 changed files
with
22,203 additions
and
4,136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: size-label | ||
on: pull_request | ||
jobs: | ||
size-label: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: size-label | ||
uses: "webdoky/size-label-action@main" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: spellcheck | ||
on: [pull_request] | ||
jobs: | ||
prepare-translation: | ||
outputs: | ||
translation: ${{ steps.translation-check.outputs.translation }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- id: changed-files | ||
run: git diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > ./changed_files.txt | ||
- name: Check translation | ||
# Check there is only one translation change | ||
# If there are more than one, the workflow will fail | ||
id: translation-changes | ||
run: | | ||
changed_files=$(cat ./changed_files.txt) | ||
if [ -z "$changed_files" ]; then | ||
echo "No files changed" | ||
else | ||
translation_files=$(echo "$changed_files" | grep -E ".*\.md" || ./pass.sh) | ||
echo "$translation_files" | ||
echo "$translation_files" > ./translation_files.txt | ||
fi | ||
- id: translation-check | ||
run: | | ||
translation_files=$(cat ./translation_files.txt) | ||
if [ -z "$translation_files" ]; then | ||
echo "No translation files changed" | ||
else | ||
if [ $(echo "$translation_files" | wc -l) -gt 1 ]; then | ||
echo "More than one translation file changed" | ||
exit 1 | ||
else | ||
echo "translation=$translation_files" >> $GITHUB_OUTPUT | ||
fi | ||
fi | ||
languagetool: | ||
if: ${{ needs.prepare-translation.outputs.translation != '' }} | ||
name: runner / languagetool | ||
needs: [prepare-translation] | ||
outputs: | ||
has_matches: ${{ steps.check-spelling.outputs.has_matches }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Remove code blocks | ||
run: | | ||
file=${{ needs.prepare-translation.outputs.translation }} | ||
sed -i '/```/,/```/d' $file | ||
# Strip all macros | ||
- id: strip-macros | ||
run: | | ||
file=${{ needs.prepare-translation.outputs.translation }} | ||
# Remove all macros with no arguments | ||
sed -i 's/{{[a-zA-Z_-]*}}//' $file | ||
# Replace macros with one argument | ||
sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\))}}/\1/g' $file | ||
# Replace macros with two arguments | ||
sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\))}}/\2/g' $file | ||
# Replace macros with more than two arguments | ||
sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\))}}/\2/g' $file | ||
# Reduce markdown to plain text | ||
- run: sudo apt install pandoc -y | ||
- id: md2txt | ||
name: Convert markdown to plain text | ||
run: | | ||
file=${{ needs.prepare-translation.outputs.translation }} | ||
newFileName=$(echo $file | sed 's/\.md/\.txt/') | ||
pandoc -f markdown -t plain -o $newFileName $file | ||
echo "translation=$newFileName" >> $GITHUB_OUTPUT | ||
echo $newFileName | ||
# Error if translation file is not found | ||
- if: steps.md2txt.outputs.translation == '' | ||
name: Check translation is found | ||
run: echo "No translation file found" && exit 1 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
distribution: "temurin" | ||
java-version: "8" | ||
- name: Download LanguageTool | ||
run: wget -q https://languagetool.org/download/LanguageTool-6.3.zip | ||
- name: Unzip LanguageTool | ||
run: unzip -qq LanguageTool-6.3.zip | ||
- name: Add spelling additions | ||
run: | | ||
cat uk_spelling_additions.txt >> ./LanguageTool-6.3/org/languagetool/resource/uk/hunspell/spelling.txt | ||
cat uk_ignore_additions.txt >> ./LanguageTool-6.3/org/languagetool/resource/uk/hunspell/ignore.txt | ||
- id: disabled-rules | ||
name: Determine disabled rules | ||
run: echo "disabled_rules=$(cat disabled_rules.txt | tr '\n' ',')" >> $GITHUB_OUTPUT | ||
- id: check-spelling | ||
name: Check spelling | ||
run: | | ||
cd LanguageTool-6.3 | ||
java -jar languagetool-commandline.jar -d ${{steps.disabled-rules.outputs.disabled_rules}} -l uk --json ../${{ steps.md2txt.outputs.translation }} > ../result.json | ||
matches=$(cat ../result.json | jq '.matches') | ||
# Check if matches equal [] | ||
echo "has_matches=$(if [ "$matches" == "[]" ]; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | ||
- name: Upload result.json | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: result | ||
path: result.json | ||
- name: Upload text file | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: text | ||
path: ${{ steps.md2txt.outputs.translation }} | ||
report-spelling: | ||
if: ${{ needs.languagetool.outputs.has_matches != 'false' }} | ||
name: Report spelling | ||
needs: [prepare-translation, languagetool] | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: result | ||
path: . | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "16" | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: text | ||
path: . | ||
- name: Create mapping | ||
run: node scripts/create-file-mapping.js ./index.txt ${{ needs.prepare-translation.outputs.translation }} > ./mapping.json && cat ./mapping.json | ||
- id: create-message | ||
name: Create message | ||
run: node scripts/create-message.js ${{ needs.prepare-translation.outputs.translation }} > message.txt && cat ./message.txt | ||
# - uses: reviewdog/action-setup@v1 | ||
# - name: Send results | ||
# run: | | ||
# export REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} | ||
# cat ./message.txt | reviewdog -efm="%A%f:%l:%c:%e:%k: %m%Z" -fail-on-error -reporter=github-pr-review -filter-mode=nofilter -name="LanguageTool" -level=info | ||
- name: Send results | ||
uses: mshick/add-pr-comment@v2 | ||
with: | ||
message-id: ${{ needs.prepare-translation.outputs.translation }} | ||
message-path: ./message.txt | ||
refresh-message-position: true | ||
- name: Exit with error | ||
run: echo "Spelling errors found" && cat result.json && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
node_modules | ||
.DS_Store | ||
.DS_Store | ||
/output.* | ||
/input.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"!*.md": "prettier --ignore-unknown --write", | ||
"*.md": [ | ||
"markdownlint-cli2 --fix", | ||
"node scripts/front-matter_linter.js --fix true", | ||
"prettier --write" | ||
], | ||
"tests/**/*.*": "yarn test:front-matter-linter" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.