diff --git a/.github/workflows/pr-check-lint_content.yml b/.github/workflows/pr-check-lint_content.yml index 6fa3dd277ed621..7c10802e7bae52 100644 --- a/.github/workflows/pr-check-lint_content.yml +++ b/.github/workflows/pr-check-lint_content.yml @@ -62,6 +62,25 @@ jobs: - name: Install all yarn packages run: yarn --frozen-lockfile + - uses: actions/checkout@v3 + with: + repository: mdn/content + path: mdn/content + + - name: Setup Node.js environment for mdn/content + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + cache-dependency-path: mdn/content/yarn.lock + + - name: Install all yarn packages for mdn/content + working-directory: ${{ github.workspace }}/mdn/content + run: yarn --frozen-lockfile + env: + # https://github.com/microsoft/vscode-ripgrep#github-api-limit-note + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Lint and format markdown files if: ${{ env.DIFF_DOCUMENTS }} run: | @@ -79,6 +98,14 @@ jobs: echo "${EOF}" >> $GITHUB_ENV echo "MD_LINT_FAILED=${MD_LINT_FAILED}" >> $GITHUB_ENV + echo "Linting front-matter" + FM_LINT_FAILED=false + FM_LINT_LOG=$(cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/front-matter-config.json --fix true ${files_to_lint} 2>&1) || FM_LINT_FAILED=true + echo "FM_LINT_LOG<<${EOF}" >> $GITHUB_ENV + echo "${FM_LINT_LOG}" >> $GITHUB_ENV + echo "${EOF}" >> $GITHUB_ENV + echo "FM_LINT_FAILED=${FM_LINT_FAILED}" >> $GITHUB_ENV + echo "Running Prettier" yarn prettier -w ${files_to_lint}