Skip to content

Commit bc2677a

Browse files
committed
improve generate-help-docs
1 parent 533ba60 commit bc2677a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/actions/generate-help-docs.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ output = output.replace(
1212
'',
1313
)
1414

15-
const readmePath = join('..', '..', 'README.md')
16-
const readme = await readFile(readmePath, 'utf-8')
17-
18-
let updatedReadme = readme.replace(/(?<=<!-- USAGE START -->\n\n```\n)[\s\S]*?(?=```\n\n<!-- USAGE END -->)/, output)
19-
2015
const codemods = TRANSFORM_OPTIONS.map(({ value, description, version }) => {
2116
return `### ${value.replaceAll('-', ' ')} (v${version})
2217
@@ -25,6 +20,11 @@ ${description}
2520
`
2621
}).join('')
2722

28-
updatedReadme = updatedReadme.replace(/(?<=<!-- CODEMODS START -->\n\n)[\s\S]*?(?=<!-- CODEMODS END -->)/, codemods)
23+
const readmePath = join('..', '..', 'README.md')
24+
const readme = await readFile(readmePath, 'utf-8')
25+
26+
const updatedReadme = readme
27+
.replace(/(?<=<!-- USAGE START -->\n\n```\n)[\s\S]*?(?=```\n\n<!-- USAGE END -->)/, output)
28+
.replace(/(?<=<!-- CODEMODS START -->\n\n)[\s\S]*?(?=<!-- CODEMODS END -->)/, codemods)
2929

3030
await writeFile(readmePath, updatedReadme, 'utf-8')

.github/workflows/generate-readme.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Generate dynamic README
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main

0 commit comments

Comments
 (0)