Create Markdownlint auto-fix PR #618
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Markdownlint auto-fix PR | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
fix: | |
if: github.repository == 'mdn/translated-content' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
lang: | |
- es | |
- fr | |
- ja | |
- ko | |
- pt-br | |
- ru | |
- zh-cn | |
- zh-tw | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: mdn/content | |
path: mdn/content | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: yarn | |
cache-dependency-path: "**/yarn.lock" | |
- 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 }} | |
HUSKY: 0 | |
- 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 Markdown files | |
run: | | |
yarn markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md" | |
node ./scripts/check-url-locale.js --fix "files/${{ matrix.lang }}" | |
ls -d 2>/dev/null "files/${{ matrix.lang }}" "docs/${{ matrix.lang }}" | xargs yarn autocorrect --fix | |
yarn prettier -w "**/${{ matrix.lang }}/**/*.md" | |
cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/front-matter-config.json "${{ github.workspace }}/files/${{ matrix.lang }}" | |
- name: Create PR with only fixable issues | |
if: success() | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: "${{ matrix.lang }}: auto-fix Markdownlint issues" | |
branch: markdownlint-auto-cleanup-${{ matrix.lang }} | |
title: "Markdownlint auto-cleanup for ${{ matrix.lang }}" | |
author: mdn-bot <[email protected]> | |
committer: mdn-bot <[email protected]> | |
body: | | |
All issues auto-fixed | |
labels: | | |
automated pr | |
token: ${{ secrets.AUTOMERGE_TOKEN }} | |
- name: Create PR with notice on unfixed issues | |
if: failure() | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: "${{ matrix.lang }}: auto-fix Markdownlint issues" | |
branch: markdownlint-auto-cleanup-${{ matrix.lang }} | |
title: "Markdownlint auto-cleanup for ${{ matrix.lang }}" | |
author: mdn-bot <[email protected]> | |
committer: mdn-bot <[email protected]> | |
body: | | |
Auto-fix was run, but additional issues found. | |
Please review the run log: https://github.com/mdn/translated-content/actions/runs/${{ github.run_id }} | |
labels: | | |
automated pr | |
token: ${{ secrets.AUTOMERGE_TOKEN }} |