Skip to content

Commit 7154402

Browse files
committed
fix(helm/generate-docs): lint generated files
Signed-off-by: Emilien Escalle <[email protected]>
1 parent cdd70c2 commit 7154402

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

actions/helm/generate-docs/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ runs:
7777
core.setOutput("values-file", valuesFile);
7878
}
7979
80+
// Generate markdownlint config file if not exists
81+
const fs = require('node:fs');
82+
const path = require('node:path');
83+
let markdownlintConfigPath = path.join(workingDirectory, ".markdownlint.json");
84+
if (!fs.existsSync(markdownlintConfigPath)) {
85+
markdownlintConfigPath = path.join(process.env.RUNNER_TEMP, `markdownlint-config-${Date.now()}.json`);
86+
const defaultConfig = {
87+
"default": true,
88+
"line-length": { "max": 300 }
89+
};
90+
fs.writeFileSync(markdownlintConfigPath, JSON.stringify(defaultConfig, null, 2));
91+
}
92+
core.setOutput("markdownlint-config-path", markdownlintConfigPath);
93+
8094
- uses: hoverkraft-tech/ci-github-common/actions/checkout@5f11437c716059f30c635f90055060e4ef8b31a0 # 0.28.0
8195

8296
- uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
@@ -93,6 +107,7 @@ runs:
93107
uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0
94108
with:
95109
fix: true
110+
config: ${{ steps.prepare-variables.outputs.markdownlint-config-path }}
96111
globs: ${{ steps.prepare-variables.outputs.working-directory }}/**/*.md
97112

98113
- shell: bash

0 commit comments

Comments
 (0)