Skip to content

Commit f79a217

Browse files
Copilotneilime
andcommitted
fix: reorder markdown processing to run prettier after markdownlint
Changed the order of steps in generate-docs action: - Old order: textlint → prettier → markdownlint --fix → validate - New order: textlint → markdownlint --fix → prettier → validate This ensures prettier's table formatting (with aligned columns) is the final result before validation, avoiding MD060 lint errors. Also added ignoreReturnCode: true to markdownlint fix step so it doesn't fail on unfixable issues before prettier can format. Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent 6fba2ae commit f79a217

1 file changed

Lines changed: 19 additions & 21 deletions

File tree

actions/helm/generate-docs/action.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ runs:
115115
const defaultConfig = {
116116
"default": true,
117117
"line-length": false,
118-
// Disable MD060 because Prettier formats tables without aligned pipes,
119-
// and markdownlint cannot auto-fix this rule
120-
"MD060": false,
121118
"outputFormatters": [
122119
[
123120
"markdownlint-cli2-formatter-template",
@@ -176,6 +173,25 @@ runs:
176173
cwd: process.env.WORKING_DIRECTORY,
177174
});
178175
176+
- name: Lint Fix markdown files
177+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
178+
env:
179+
NODE_PATH: ${{ github.action_path }}/node_modules
180+
WORKING_DIRECTORY: ${{ steps.prepare-variables.outputs.working-directory }}
181+
FILES_PATTERN: ${{ steps.prepare-variables.outputs.files-pattern }}
182+
CONFIG_PATH: ${{ steps.prepare-variables.outputs.markdownlint-config-path }}
183+
with:
184+
script: |
185+
await exec.exec('npx', [
186+
'markdownlint-cli2',
187+
'--fix',
188+
'--config', process.env.CONFIG_PATH,
189+
process.env.FILES_PATTERN,
190+
], {
191+
cwd: process.env.WORKING_DIRECTORY,
192+
ignoreReturnCode: true,
193+
});
194+
179195
- name: Cache prettier
180196
id: cache-prettier
181197
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
@@ -208,24 +224,6 @@ runs:
208224
cwd: process.env.WORKING_DIRECTORY,
209225
});
210226
211-
- name: Lint Fix markdown files
212-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
213-
env:
214-
NODE_PATH: ${{ github.action_path }}/node_modules
215-
WORKING_DIRECTORY: ${{ steps.prepare-variables.outputs.working-directory }}
216-
FILES_PATTERN: ${{ steps.prepare-variables.outputs.files-pattern }}
217-
CONFIG_PATH: ${{ steps.prepare-variables.outputs.markdownlint-config-path }}
218-
with:
219-
script: |
220-
await exec.exec('npx', [
221-
'markdownlint-cli2',
222-
'--fix',
223-
'--config', process.env.CONFIG_PATH,
224-
process.env.FILES_PATTERN,
225-
], {
226-
cwd: process.env.WORKING_DIRECTORY,
227-
});
228-
229227
- uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
230228
if: inputs.github-app-id
231229
id: generate-token

0 commit comments

Comments
 (0)