Skip to content

Commit

Permalink
Merge branch 'mdn:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavweiss authored Oct 7, 2024
2 parents 3ef14f2 + 1b4e6d1 commit 82cf078
Show file tree
Hide file tree
Showing 7,653 changed files with 98,555 additions and 45,295 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
# MathML
/files/en-us/web/mathml/ @mdn/content-mathml

# MDN Firefox Release Notes
/files/en-us/mozilla/firefox @mdn/core-yari-content

# ============================= CONTROL FILES ============================= #
# The CODEOWNERS file must end with these matches: Any pull request changing
# one or more of these files should be escalated to the owners specified here.
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Content:Other:
- files/en-us/web/exslt/**
- files/en-us/web/opensearch/**
- files/en-us/web/privacy/**
- files/en-us/web/text_fragments/**
- files/en-us/web/uri/**
- files/en-us/web/xml/**
- files/en-us/web/xpath/**
- files/en-us/web/xslt/**
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/action-dependabot-auto-merge@v2.6
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
11 changes: 6 additions & 5 deletions .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 Expand Up @@ -82,7 +82,7 @@ jobs:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
EOF="$(openssl rand -hex 8)"
files_to_lint="${{ env.DIFF_DOCUMENTS }}"
files_to_lint="$DIFF_DOCUMENTS"
echo "Running markdownlint --fix"
MD_LINT_FAILED=false
Expand Down Expand Up @@ -130,14 +130,15 @@ jobs:
-name="mdn-linter" \
-f=diff \
-f.diff.strip=1 \
-filter-mode=diff_context \
-reporter=github-pr-review < "${TMPFILE}"
- name: Add reviews for markdownlint errors
if: env.MD_LINT_FAILED == 'true'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${{ env.MD_LINT_LOG }}" | \
echo "${MD_LINT_LOG}" | \
reviewdog \
-efm="%f:%l:%c %m" \
-efm="%f:%l %m" \
Expand All @@ -149,8 +150,8 @@ jobs:
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true'
run: |
echo -e "\nLogs from markdownlint:"
echo "${{ env.MD_LINT_LOG }}"
echo "${MD_LINT_LOG}"
echo -e "\nLogs from front-matter linter:"
echo "${{ env.FM_LINT_LOG }}"
echo "${FM_LINT_LOG}"
echo -e "\nPlease fix all the linting issues mentioned in above logs and in the review comments."
exit 1
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
2 changes: 1 addition & 1 deletion .github/workflows/pr-review-companion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

- name: Install Python poetry
if: ${{ env.HAS_ARTIFACT }}
uses: snok/install-poetry@v1.3
uses: snok/install-poetry@v1.4
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down
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).
5 changes: 2 additions & 3 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env sh

BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [ "$BRANCH" != "main" ]; then
exit 0
Expand All @@ -9,7 +7,8 @@ if [ -f ".husky/_/history" ]; then
lastHash=$(cat ./.husky/_/history)
isUpdated=$(git diff $lastHash HEAD -- ./package.json)
if [ "$isUpdated" != "" ]; then
echo "\n⚠🔥 'package.json' has changed. Please run 'yarn install'! 🔥"
echo
echo "⚠🔥 'package.json' has changed. Please run 'yarn install'! 🔥"
fi
else
yarn install
Expand Down
20 changes: 20 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,24 @@ export default {
`yarn content fix-redirects en-US`,
`yarn content validate-redirects en-us --strict`,
],
"!*.md": (filenames) => [
`prettier --ignore-unknown --write ${filenames.join(" ")}`,
],
"*.md": (filenames) => [
`markdownlint-cli2 --fix ${filenames.join(" ")}`,
`node scripts/front-matter_linter.js --fix true ${filenames.join(" ")}`,
`node scripts/update-moved-file-links.js --check`,
`prettier --write ${filenames.join(" ")}`,
],
"tests/**/*.*": (filenames) => [`yarn test:front-matter-linter`],
"*.{svg,png,jpeg,jpg,gif}": (filenames) => [
`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`,
],
};
12 changes: 0 additions & 12 deletions .lintstagedrc.json

This file was deleted.

23 changes: 21 additions & 2 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

{
"default": true,
// Disabled, as some callouts include headings.
"heading-increment": false,
"heading-increment": true,
"ul-style": {
"style": "dash",
},
Expand Down Expand Up @@ -212,6 +211,26 @@
"searchPattern": "/(\\[[^\\]]*?\\]\\(([^\\)\\n]|\\([^\\)\\n]\\)|\\s[\"'])+?)(\\n|\\s|[,:][\\s\\n])/gm",
"searchScope": "text",
},
{
"name": "text-code-fence",
"message": "Use 'plain' tag",
"searchPattern": "/(^ *`{3,})(text|none|unix)/gm",
"replace": "$1plain",
"searchScope": "text",
},
{
"name": "gfm-alert",
"message": "Use the GFM syntax: https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#notes_warnings_and_callouts",
"searchPattern": "/^ *> \\*\\*(Note|Warning|Callout):\\*\\*(?! [[{`_*])/gm",
"searchScope": "text",
},
{
"name": "bad-gfm-alert",
"message": "Use the correct GFM syntax: `> [!NOTE]`",
// TODO this should use the modifier syntax; until it has better Node support
"searchPattern": "/^ *> !?\\[!?((?!NOTE)[Nn][Oo][Tt][Ee]|(?!WARNING)[Ww][Aa][Rr][Nn][Ii][Nn][Gg]|(?!CALLOUT)[Cc][Aa][Ll][Ll][Oo][Uu][Tt])\\]\\n|^ *> (?!\\[!)!?\\[!?(NOTE|WARNING|CALLOUT)\\]\\n/gm",
"searchScope": "text",
},
],
},
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.17
v18
Loading

0 comments on commit 82cf078

Please sign in to comment.