Skip to content

Commit

Permalink
Merge branch 'main' into add_input_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammednumaan authored Jan 4, 2025
2 parents fce0bb4 + 178630a commit 25a90ff
Show file tree
Hide file tree
Showing 8,974 changed files with 214,284 additions and 145,669 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
# MDN Firefox Release Notes
/files/en-us/mozilla/firefox @mdn/core-yari-content

# New templates and sidebars
/files/jsondata/L10n-Template.json @mdn/core-dev
/files/sidebars @mdn/core-dev

# ============================= 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/ISSUE_TEMPLATE/content-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
### Before you start
**Want to change a page yourself?** This content is open source!
↩ Look for the _Edit on GitHub_ link on any MDN page.
↩ Look for the _View this page on GitHub_ link on any MDN page to edit the content on GitHub.com afterwards.
**Is your issue about a browser compatibility table?**
↩ Use the _Report problems with this compatibility data on GitHub_ link next to a compatibility table.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/page-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
### Before you start
**Want to change this page yourself?** This content is open source!
↩ Go back and use the _Edit on GitHub_ link on the page.
↩ Go back and use the _View this page on GitHub_ link on the page to edit the content on GitHub.com afterwards.
**Is your issue about the browser compatibility table?**
↩ Go back and use the _Report problems with this compatibility data on GitHub_ link on the page.
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/**
5 changes: 3 additions & 2 deletions .github/workflows/auto-cleanup-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ jobs:
yarn content fix-flaws
yarn fix:md
yarn fix:fm
node scripts/sort_and_unique_file_lines.js .vscode/dictionaries
- 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 +50,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
51 changes: 39 additions & 12 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 All @@ -101,6 +101,12 @@ jobs:
echo "FM_LINT_FAILED=${FM_LINT_FAILED}" >> $GITHUB_ENV
echo "Running Prettier"
PRETTIER_FAILED=false
PRETTIER_LOG=$(yarn prettier --check ${files_to_lint} 2>&1) || PRETTIER_FAILED=true
echo "PRETTIER_LOG<<${EOF}" >> $GITHUB_ENV
echo "${PRETTIER_LOG}" >> $GITHUB_ENV
echo "${EOF}" >> $GITHUB_ENV
echo "PRETTIER_FAILED=${PRETTIER_FAILED}" >> $GITHUB_ENV
yarn prettier -w ${files_to_lint}
if [[ -n $(git diff) ]]; then
Expand All @@ -110,16 +116,17 @@ jobs:
# info for troubleshooting
echo MD_LINT_FAILED=${MD_LINT_FAILED}
echo FM_LINT_FAILED=${FM_LINT_FAILED}
echo PRETTIER_FAILED=${PRETTIER_FAILED}
git diff
- name: Setup reviewdog
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true'
if: ${{ env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: Suggest changes using diff
if: env.FILES_MODIFIED == 'true'
if: ${{ env.FILES_MODIFIED == 'true' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -134,11 +141,11 @@ jobs:
-reporter=github-pr-review < "${TMPFILE}"
- name: Add reviews for markdownlint errors
if: env.MD_LINT_FAILED == 'true'
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 @@ -147,11 +154,31 @@ jobs:
-reporter="github-pr-review"
- name: Fail if any issues pending
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true'
if: ${{ env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true' }}
env:
MD_LINT_FAILED: ${{ env.MD_LINT_FAILED }}
FM_LINT_FAILED: ${{ env.FM_LINT_FAILED }}
PRETTIER_FAILED: ${{ env.PRETTIER_FAILED }}
MD_LINT_LOG: ${{ env.MD_LINT_LOG }}
FM_LINT_LOG: ${{ env.FM_LINT_LOG }}
PRETTIER_LOG: ${{ env.PRETTIER_LOG }}
run: |
echo -e "\nLogs from markdownlint:"
echo "${{ env.MD_LINT_LOG }}"
echo -e "\nLogs from front-matter linter:"
echo "${{ env.FM_LINT_LOG }}"
echo -e "\nPlease fix all the linting issues mentioned in above logs and in the review comments."
echo -e "\nPlease fix all the linting issues mentioned in the following logs and in the PR review comments."
if [[ ${MD_LINT_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from markdownlint:"
echo "${MD_LINT_LOG}"
fi
if [[ ${FM_LINT_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from front-matter linter:"
echo "${FM_LINT_LOG}"
fi
if [[ ${PRETTIER_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from Prettier formatter:"
echo "${PRETTIER_LOG}"
echo -e "\nYou can use Prettier playground to format the files online (configuration pre-filled): https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBiABABwIYGd7owAWc6CMAlgE6kBmFANqSTSADQgSaXS7KjYqVCAHcACoIR8U2BiOwBPPhwBGVbGADWcGAGVsAWzgAZClDjIYVAK5xV6rTt04wZgOaWbdkLjgGKnrYccAAemHBUFEawsgAqEVCCFHDStLK+HLjuTACK1hDwyGkMGSAAVrghutlweQUWSMWlAI758GLCmNIgeAC05nAAJkPsIFbYjO4AwhAGBtjIPQwMo1lQbkwAgjBWFCrW7RGm5kXp3kQwBgwA6kQU8LgucLpS9xQAbvcKi2C4yiDvWwASSgw1gujAkW4m1BuhgCiYpxK3kwwl813UmEWqJSEXeFg4Zl8VBgHWwbnmSNKOCoxMW8yomkGoigo1RZhg1wog2IyAAHAAGDg0VrUOBkikLRpnDgwbAqLk8ojIABMHGsvli8tSMpAfhUQ2Gg2M2HW1nJcAAYhAqPMdu5FtgDhAQABfV1AA \n"
fi
exit 1
30 changes: 30 additions & 0 deletions .github/workflows/pr-check_cspell_lists.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check cSpell lists

on:
pull_request:
branches:
- main
paths:
- .vscode/dictionaries/*

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout-cone-mode: false
sparse-checkout: |
.vscode/dictionaries/*
.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 --check .vscode/dictionaries
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]
> If the word is actually valid or it is required to be ignored, consider adding it to one of the dictionaries under [`.vscode/dictionaries`](https://github.com/mdn/content/tree/main/.vscode/dictionaries).
3 changes: 2 additions & 1 deletion .husky/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -7,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
3 changes: 3 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ export default {
`yarn filecheck ${filenames.join(" ")}`,
],
"*": (filenames) => [`node scripts/log-url-issues.js`],
".vscode/dictionaries/*.txt": (filenames) => [
`node scripts/sort_and_unique_file_lines.js ${filenames.join(" ")}`,
],
};
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
v20
Loading

0 comments on commit 25a90ff

Please sign in to comment.