diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/CODEOWNERS | 16 | ||||
-rw-r--r-- | .github/workflows/pr-check_redirects.yml | 16 | ||||
-rw-r--r-- | .github/workflows/pr-test.yml | 19 | ||||
-rw-r--r-- | .github/workflows/sync-translated-content.yml | 63 |
4 files changed, 93 insertions, 21 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d176ca1e76..0bf290aa3f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -17,6 +17,22 @@ /files/ @mdn/core-yari-content # ---------------------------------------------------------------------------- +# CHINESE (zh-CN, zh-TW) CONTENT OWNER(S) +# ---------------------------------------------------------------------------- +/files/zh-cn/ @mdn/yari-content-zh +/files/zh-tw/ @mdn/yari-content-zh + +# ---------------------------------------------------------------------------- +# FRENCH (fr) CONTENT OWNER(S) +# ---------------------------------------------------------------------------- +/files/fr/ @mdn/yari-content-fr + +# ---------------------------------------------------------------------------- +# JAPANESE (ja) CONTENT OWNER(S) +# ---------------------------------------------------------------------------- +/files/ja/ @mdn/yari-content-ja + +# ---------------------------------------------------------------------------- # CONTROL FILES OWNER(S) # ---------------------------------------------------------------------------- # These should be the last matches in this file, since any pull request that diff --git a/.github/workflows/pr-check_redirects.yml b/.github/workflows/pr-check_redirects.yml index 05f463bc57..02bd442498 100644 --- a/.github/workflows/pr-check_redirects.yml +++ b/.github/workflows/pr-check_redirects.yml @@ -26,18 +26,16 @@ jobs: with: node-version: "12" - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2.1.4 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Cache node_modules + uses: actions/cache@v2.1.4 + id: cached-node_modules with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + path: | + ${{ github.workspace }}/mdn/content/node_modules + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - name: Install all yarn packages + if: steps.cached-node_modules.outputs.cache-hit != 'true' working-directory: ${{ github.workspace }}/mdn/content run: | yarn --frozen-lockfile diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index af6fada9aa..cc088b8604 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -1,13 +1,8 @@ -# Note that this workflow uses `get-diff-action` which is important. -# It gives us an environment variable called `GIT_DIFF` which is a string -# that is a list of file paths. -# If you want to do what this workflow does on your laptop you can simulate -# it like this: -# -# export GIT_DIFF=`git diff --name-only main... | grep 'files/' | grep '\.html$'` -# node content build --no-progressbar --files="${GIT_DIFF}" -# -# That way, you can behave on your laptop like, this action behaves here. +# This is more or less a copy of +# https://github.com/mdn/content/blob/main/.github/workflows/pr-test.yml +# but done in a way that it first checks out mdn/translated-content (or +# fork of) and _then_ checks out mdn/content which has the relevant +# CI related tooling. name: PR Test @@ -38,8 +33,8 @@ jobs: id: cached-node_modules with: path: | - {{ github.workspace }}/mdn/content/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-1 + ${{ github.workspace }}/mdn/content/node_modules + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - name: Install all yarn packages if: steps.cached-node_modules.outputs.cache-hit != 'true' diff --git a/.github/workflows/sync-translated-content.yml b/.github/workflows/sync-translated-content.yml new file mode 100644 index 0000000000..ab5cbd40c0 --- /dev/null +++ b/.github/workflows/sync-translated-content.yml @@ -0,0 +1,63 @@ +name: Sync Translated Content + +on: + workflow_dispatch: + inputs: + notes: + description: "Notes" + required: false + default: "" + schedule: + # * is a special character in YAML so you have to quote this string + - cron: "0 */24 * * *" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/checkout@v2 + with: + repository: mdn/content + path: mdn/content + + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.4 + with: + node-version: "12" + + - name: Cache node_modules + uses: actions/cache@v2.1.4 + id: cached-node_modules + with: + path: | + ${{ github.workspace }}/mdn/content/node_modules + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + + - name: Install all yarn packages + if: steps.cached-node_modules.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/mdn/content + run: | + yarn --frozen-lockfile + + - name: Sync translated content + env: + CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files + CONTENT_TRANSLATED_ROOT: ${{ github.workspace }}/files + working-directory: ${{ github.workspace }}/mdn/content + run: | + yarn content sync-translated-content + + - name: Commit changes + # git commit will fail if there are no changes but that's okay! + continue-on-error: true + run: | + cd $GITHUB_WORKSPACE + git remote add upstream "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git config --local user.email "actions@users.noreply.github.com" + git config --local user.name "MDN" + git commit -a -m "[CRON] sync translated content" && \ + git pull --rebase upstream main && \ + git push upstream main |