Skip to content

Commit

Permalink
Merge branch 'main' into string-charCodeAt
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 authored Jul 29, 2023
2 parents bc5bf5d + a4e5c12 commit 1c2ca3a
Show file tree
Hide file tree
Showing 10,806 changed files with 163,583 additions and 153,035 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions .autocorrectignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AutoCorrect Link ignore rules.
# https://github.com/huacnlee/autocorrect
#
# Like `.gitignore`, this file to tell AutoCorrect which files need to check, some need to ignore.
files/
docs/
!files/zh-cn/
4 changes: 4 additions & 0 deletions .autocorrectrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
textRules:
一二三,四五六.七八九: 0
一二三,四五六,七八九,一二三,四五六,七八九: 0
9.9亿: 0
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@
/.github/ @mdn/core-dev
/* @mdn/core-dev
/*.md @mdn/core-dev @mdn/core-yari-content
/.prettierignore
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/new-content-suggestion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ title: "Content suggestion: <TITLE OF SUGGESTION>"
---

## What is the new suggestion?

<!-- include a short description of the content work suggestion -->

## Why is it important or useful?

<!-- Tell us why the idea is important or useful. Include any information you
can think of that would be useful, for example:
Expand Down
8 changes: 6 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# For more ideas, see https://github.com/actions/labeler#common-examples

system:
- package.json
- yarn.lock
- .github/**/*
- .husky/**/*
- .vscode/**/*
- .*
- front-matter-config.json

l10n-de:
- files/de/**/*
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/autocorrect-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow to use AutoCorrect tool for checking the copywriting, correct spaces and punctuations for CJK contents.
#
# For example:
#
# - incorrect: "欢迎阅读MDN文档."
# - correct: "欢迎阅读 MDN 文档。"
#
# - incorrect: "Welcome,this is MDN Web Docs。"
# - correct: "Welcome, to read MDN Web Docs."
#
# More details:
# https://github.com/huacnlee/autocorrect
name: AutoCorrect Lint
on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Get changed files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.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/zh-cn/" | xargs)
echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV
- name: AutoCorrect changed content
if: ${{ env.DIFF_DOCUMENTS }}
uses: huacnlee/[email protected]
with:
args: ${{ env.DIFF_DOCUMENTS }} --lint --no-diff-bg-color
1 change: 1 addition & 0 deletions .github/workflows/markdown-lint-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- name: Lint markdown files
run: |
yarn markdownlint-cli2-fix "**/${{ matrix.lang }}/**/*.md"
yarn prettier -w "**/${{ matrix.lang }}/**/*.md"
- name: Create PR with only fixable issues
if: success()
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pr-check_markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ jobs:
echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
files_to_lint="${{ env.DIFF_DOCUMENTS }}"
yarn markdownlint-cli2 ${files_to_lint}
- name: Prettier markdown files
run: |
files_to_lint="${{ env.DIFF_DOCUMENTS }}"
yarn prettier -c ${files_to_lint}
16 changes: 5 additions & 11 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,8 @@ jobs:
# we set this to disable that stuff.
REACT_APP_CRUD_MODE_READONLY: true

# Setting this to an empty string effectively means that the
# <iframe> src will end up being the relative URL of the current
# document as a base.
# I.e. like this, if the current document is '/en-US/docs/Foo':
# <iframe src="/en-US/docs/Foo/_samples_/index.html">
# ...for example.
# Yes, it's potentially "insecure" because the iframe will execute
# whatever code is inserted into the code example. But since the
# whole (possible) domain for PR builds will never be somewhere
# where there are interesting cookies, it's a safe choice.
BUILD_LIVE_SAMPLES_BASE_URL: ""
BUILD_LIVE_SAMPLES_BASE_URL: https://live.mdnyalp.dev
BUILD_LEGACY_LIVE_SAMPLES_BASE_URL: https://live-samples.mdn.allizom.net

# In these builds we never care for or need the ability to sign in.
# This environment variable will disable that functionality entirely.
Expand All @@ -104,6 +95,9 @@ jobs:
# TODO: This should be implicit when `CI=true`
BUILD_NO_PROGRESSBAR: true

# Playground
REACT_APP_PLAYGROUND_BASE_HOST: mdnyalp.dev

# If we don't do this the built files will end up in
# `node_modules/@mdn/yari/client/build/` and we don't want that
# to get pushed into the cache.
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: reviewdog

on:
- pull_request

jobs:
prettier:
# do not run on forks
if: github.repository == 'mdn/translated-content'
name: prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get changed files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} --jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename' | xargs)
echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: yarn

- name: Install all yarn packages
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Perform linting
run: yarn prettier --ignore-unknown --write ${{ env.DIFF_DOCUMENTS }}

- name: Submit suggestion
uses: reviewdog/action-suggester@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tool_name: prettier
1 change: 1 addition & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"*": "prettier --ignore-unknown --write",
"*.md": "markdownlint-cli2-fix"
}
Loading

0 comments on commit 1c2ca3a

Please sign in to comment.