Skip to content

Commit

Permalink
Merge branch 'main' into 35381-angular-update
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmth authored Sep 30, 2024
2 parents 5dc5f11 + 5a4e6f2 commit 050ed0b
Show file tree
Hide file tree
Showing 2,394 changed files with 24,438 additions and 9,193 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/auto-cleanup-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
yarn content fix-flaws
yarn fix:md
yarn fix:fm
node scripts/sort_and_unique_file_lines.js .vscode/ignore-list.txt
node scripts/sort_and_unique_file_lines.js .vscode/terms-abbreviations.txt
- name: Create PR with only fixable issues
if: success()
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: auto-fix Markdownlint, Prettier, and front-matter issues"
branch: markdownlint-auto-cleanup
Expand All @@ -49,7 +51,7 @@ jobs:

- name: Create PR with notice on unfixed issues
if: failure()
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: auto-fix Markdownlint, Prettier, and front-matter issues"
branch: markdownlint-auto-cleanup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- uses: ahmadnassri/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/interfacedata-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: node scripts/update-interface-data.js ../webref/

- name: Create pull request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
path: mdn-content
token: ${{ secrets.AUTOMERGE_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
# Use the GitHub API to get the list of changed files
# documentation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} \
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${BASE_SHA}...${HEAD_SHA} \
--jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename')
# filter out files that are not markdown
DIFF_DOCUMENTS=$(echo "${DIFF_DOCUMENTS}" | egrep -i "^files/.*\.md$" | xargs)
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/pr-check_cspell_lists.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check cSpell lists

on:
pull_request:
branches:
- main
paths:
- .vscode/ignore-list.txt
- .vscode/terms-abbreviations.txt

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout-cone-mode: false
sparse-checkout: |
.vscode/ignore-list.txt
.vscode/terms-abbreviations.txt
.nvmrc
package.json
scripts/sort_and_unique_file_lines.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Check if cSpell word lists are in correct order
run: |
node scripts/sort_and_unique_file_lines.js .vscode/ignore-list.txt --check
node scripts/sort_and_unique_file_lines.js .vscode/terms-abbreviations.txt --check
18 changes: 9 additions & 9 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
# Use the GitHub API to get the list of changed files
# documentation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} \
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${BASE_SHA}...${HEAD_SHA} \
--jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename')
# filter out files that are not markdown files
Expand Down Expand Up @@ -97,27 +97,27 @@ jobs:
# you don't need that script as a writer. It's only used in CI
# and it can't use the default CONTENT_ROOT that gets set in
# package.json.
yarn build ${{ env.GIT_DIFF_CONTENT }}
yarn build $GIT_DIFF_CONTENT
echo "Disk usage size of the build"
du -sh ${{ env.BUILD_OUT_ROOT }}
du -sh $BUILD_OUT_ROOT
# Save the PR number into the build
echo ${{ github.event.number }} > ${{ env.BUILD_OUT_ROOT }}/NR
echo ${{ github.event.number }} > ${BUILD_OUT_ROOT}/NR
# Download the raw diff blob and store that inside the build
# directory.
# The purpose of this is for the PR Review Companion to later
# be able to use this raw diff file for the benefit of analyzing.
wget https://github.com/${{ github.repository }}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }}.diff -O ${{ env.BUILD_OUT_ROOT }}/DIFF
wget https://github.com/${{ github.repository }}/compare/${BASE_SHA}...${HEAD_SHA}.diff -O ${BUILD_OUT_ROOT}/DIFF
- name: Merge static assets with built documents
if: ${{ env.GIT_DIFF_CONTENT }}
run: |
# Exclude the .map files, as they're used for debugging JS and CSS.
rsync -a --exclude "*.map" node_modules/@mdn/yari/client/build/ ${{ env.BUILD_OUT_ROOT }}
rsync -a --exclude "*.map" node_modules/@mdn/yari/client/build/ $BUILD_OUT_ROOT
# Show the final disk usage size of the build.
du -sh ${{ env.BUILD_OUT_ROOT }}
du -sh $BUILD_OUT_ROOT
- uses: actions/upload-artifact@v4
if: ${{ env.GIT_DIFF_CONTENT }}
Expand All @@ -128,7 +128,7 @@ jobs:
- name: Check changed files
if: ${{ env.GIT_DIFF_FILES }}
run: |
echo ${{ env.GIT_DIFF_FILES }}
echo $GIT_DIFF_FILES
export CONTENT_ROOT=$(pwd)/files
yarn filecheck ${{ env.GIT_DIFF_FILES }}
yarn filecheck $GIT_DIFF_FILES
54 changes: 54 additions & 0 deletions .github/workflows/spelling-check-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Create an issue to report typos

on:
schedule:
- cron: "0 0 * * mon"
workflow_dispatch:

jobs:
sync:
if: github.repository == 'mdn/content'
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn

- name: Run scripts
run: |
echo Running spelling check...
output=$(npx cspell --no-progress --gitignore --config .vscode/cspell.json "**/*.md" || exit 0)
if [ -n "${output}" ]; then
output=$(node scripts/linkify-logs.js "${output}")
output=$(echo "$output" | sed 's/^/- /')
echo "$output"
echo "OUTPUT<<EOF" >> $GITHUB_ENV
echo "$output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "No typos found! 🎉"
fi
- name: Report spellcheck errors
if: env.OUTPUT != ''
run: |
issue=$(gh issue create --title "$TITLE" --label "$LABELS" --body "$BODY")
echo Issue URL ${issue}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: Weekly spelling check
LABELS: reported by automation
BODY: |
Typos and unknown words:
${{ env.OUTPUT }}
> [!TIP]
> To exclude words from the spellchecker, you can add valid words (web technology terms or abbreviations) to the [terms-abbreviations.txt](https://github.com/mdn/content/blob/main/.vscode/terms-abbreviations.txt) dictionary for IDE autocompletion. To ignore strings that are not words (\`AABBCC\` in code, for instance), you can add them to [ignore-list.txt](https://github.com/mdn/content/blob/main/.vscode/ignore-list.txt).
6 changes: 6 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ export default {
`yarn filecheck ${filenames.join(" ")}`,
],
"*": (filenames) => [`node scripts/log-url-issues.js`],
".vscode/ignore-list.txt": (filenames) => [
`node scripts/sort_and_unique_file_lines.js .vscode/ignore-list.txt`,
],
".vscode/terms-abbreviations.txt": (filenames) => [
`node scripts/sort_and_unique_file_lines.js .vscode/terms-abbreviations.txt`,
],
};
24 changes: 16 additions & 8 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "0.2",
"language": "en-US",
"languageId": "*",
"useGitignore": true,
"dictionaries": [
"terms-abbreviations",
"ignore-list",
"bash",
"css",
"cpp",
Expand All @@ -17,7 +20,6 @@
"markdown",
"node",
"npm",
"project-words",
"python",
"softwareTerms",
"svelte",
Expand All @@ -37,10 +39,9 @@
// TODO - add some details what these match
"\\(#\\w*\\)",
"\\]\\(\\S*\\)",
"\\]\\(\\S*\\)",
"\\*\\*\\w\\*\\*\\w*",
"\\*\\w\\*\\w*",
"#[\\w-]*",
"#[À-ž\\w-]*",
"aria-activedescendant=\"(?:[^\\\"]+|\\.)*\"",
"aria-controls=\"(?:[^\\\"]+|\\.)*\"",
"aria-describedby=\"(?:[^\\\"]+|\\.)*\"",
Expand All @@ -55,18 +56,25 @@
"for=\"(?:[^\\\"]+|\\.)*\"",
"HexValues",
"href=\"(?:[^\\\"]+|\\.)*\"",
"id=\"(?:[^\\\"]+|\\.)*\"",
"(?<=id)=\"(?:[^\\\"]+|\\.)*\"",
"lang=\".*\">.*</",
"src=\"(?:[^\\\"]+|\\.)*\"",
"url\\(\"data\\:image/svg\\+xml.*\"\\)[,;]",
"Urls"
"Urls",
"favourite-colour",
"ucaf:.*\""
],
"allowCompoundWords": true,
"dictionaryDefinitions": [
{
"name": "project-words",
"path": "./project-words.txt",
"name": "terms-abbreviations",
"path": "./terms-abbreviations.txt",
"addWords": true
},
{
"name": "ignore-list",
"path": "./ignore-list.txt",
"addWords": false,
"noSuggest": true
}
],
"enableFiletypes": ["xml"]
Expand Down
Loading

0 comments on commit 050ed0b

Please sign in to comment.