-
Notifications
You must be signed in to change notification settings - Fork 8.1k
90 lines (80 loc) · 3.01 KB
/
markdown-lint-fix.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
- 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 }}
HUSKY: 0
- uses: actions/checkout@v4
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 Markdown files
run: |
yarn markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md"
node ./scripts/check-url-locale.js --fix "files/${{ matrix.lang }}"
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@v5
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]>
body: |
All issues auto-fixed
token: ${{ secrets.AUTOMERGE_TOKEN }}
- name: Create PR with notice on unfixed issues
if: failure()
uses: peter-evans/create-pull-request@v5
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]>
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 }}
token: ${{ secrets.AUTOMERGE_TOKEN }}